Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Installing and Configuring Flux with GitLab

This lab is provided for students that do not utilize GitHub and prefer to use GitLab or some other VCS repository manager with Flux. This lab covers the installation of Flux when a student is using a repository on GitLab.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Beginner
Last updated
Sep 21, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Set Up A Repository (Project) In GitLab

    The student must have a GitLab account, and set up a repository within that account. The repository should contain two files that are Kubernetes YAML. The first, within the namespaces folder, will create a namespace for the application. The YAML is as follows:

    apiVersion: v1
    kind: Namespace
    metadata:
      labels:
        name: laflux
      name: laflux
    

    The second file is for creating the actual deployment of an NGINX server. The YAML should be in the workloads folder. That YAML is as follows:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-deployment
      namespace: laflux
      labels:
        app: nginx
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - name: nginx
            image: nginx:1.7.9
            ports:
            - containerPort: 80
    
  2. Challenge

    Establish a Terminal Session on the Kubernetes Master and Install Flux

    Use SSH to establish a session on the Kubernetes host server:

    ssh cloud_user@[IP Address Here]
    

    Use the password supplied in the lab interface.

    To verify that fluxctl was installed automatically, type:

    $ fluxctl version
    

    If it was not installed automatically, you may enter:

    $ sudo snap install fluxctl --classic
    

    Once on the server, create the namespace to run Flux:

    $ kubectl create namespace flux
    

    Then set the GLUSER environment variable:

    $ export GLUSER=[your GitLab username]
    

    Then input the command to run flux:

    $ fluxctl install 
    --git-user=${GLUSER} 
    --git-email=${GLUSER}@gmail.com 
    --git-branch=main 
    [email protected]:${GLUSER}/flux-sample 
    --git-path=namespaces,workloads 
    --namespace=flux | kubectl apply -f -
    

    You may check the deployment with the following command:

    $ kubectl -n flux rollout status deployment/flux
    
  3. Challenge

    Obtain the RSA Key Created by fluxctl, and Grant GitLab Write Permission to the Cluster

    Obtain the RSA key created by the Flux install procedure with the following command:

    $ fluxctl identity --k8s-fwd-ns flux

    Then copy the RSA key to the clipboard and use the Settings->SSH Keys feature in GitLab to add the SSH Key.

  4. Challenge

    Use the fluxctl sync Command to Synchronize the Cluster

    After the GitLab account has been granted write access to the Cluster, use the sync command to apply the YAML from the repository:

    $ fluxctl sync --k8s-fwd-ns flux

    Once the sync command has run, you may check that the namespace has been created and that the NGINX deployment has been applied and deployed:

    $ kubectl get pods --all-namespaces

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight