GitOps with Flux and Kustomize

  1. You will need to select a GitHub repository of an application or service you want to sync. You will need access to save a deploy key in GitHub for that repo. My repo as an example:
  2. We are going to install & deploy Flux into a minikube cluster. This will point to your GitHub repository. You should have minikube up and running before starting this exercise.
  3. Solidify the connection from Flux to the repository by adding a deploy key that is created after you install flux in your cluster.
  4. Sync your repo with your cluster and watch Kustomize take care of applying those changes.

2. Install & Deploy Flux

We are going to skip step 1 and jump right into step 2.

fluxctl install --manifest-generation=true --git-user=<a git user> --git-email=<email used for git><repo> --git-branch <branch> --git-path=<path to your files, additional path> --namespace=<namespace> | kubectl apply -f -
fluxctl output
kubectl get pods -n flux

An explanation of git-path


directory structure


I have added namespaces as an example of how to setup namespace the #GitOps way.



base contains all the base files. In this case, our deployment, service, and configmap YAML files. The files mentioned below can be found in our hello-word repo.

excerpt of base\deployment.yaml


In this use case, we want to deploy hello-world to the airwave-stagenamespace.

a visual assistant

3. Solidify the connection from Flux to the repository by adding a deploy key

fluxctl identity --k8s-fwd-ns flux will output an ssh public key that is generated by the Kubernetes cluster. The cluster itself has the private key.

Allow write access

4. Sync your repo with your cluster

fluxctl --k8s-fwd-ns flux sync to kick off the process. You can also wait for 5 minutes.

the git commit hash should match your latest commit in GitHub
The state of things
kubectl get pods -n airwave-stage
kubectl describe configmap hello-world-configmap -n airwave-stage
kubectl describe service airwavetech-helloworld-svc -n airwave-stage


In this exercise, we have taken our hello-world service, configured flux and Kustomize in our minikube cluster to sync with our GitHub repo, and have watched an automated deployment of that service to a specific namespace with a specific configuration. Welcome to the future. “This is heavy.”



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store