Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

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

Path Info

Clock icon Beginner
Clock icon 45m
Clock icon Feb 13, 2020

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
        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
      name: nginx-deployment
      namespace: laflux
        app: nginx
      replicas: 2
          app: nginx
            app: nginx
          - name: nginx
            image: nginx:1.7.9
            - 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 
    [email protected]:${GLUSER}/flux-sample 
    --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

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans