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: https://github.com/airwavetechio/hello-world
  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

fluxctl install --manifest-generation=true --git-user=<a git user> --git-email=<email used for git> --git-url=git@github.com:org/<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
.flux.yaml

flux\releases\namespaces

namespace\kustomization.yaml
namespaces\airwave-stage.yaml

flux\releases\base\

base\kustomization.yaml
excerpt of base\deployment.yaml
base\service.yaml
base\configmap.yaml

flux\releases\airwave-stage

a visual assistant
airwave-stage\kustomization.yaml
airwave-stage\configmap.yaml
airwave-stage\service.yaml

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

Allow write access

4. Sync your repo with your cluster

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

Conclusion

--

--

--

Helping you build the hardest parts of your Stack

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

⚙️ The State of WASM

Where’s My Fish? Revisited Part 4

My Internship Experience at LetsGrowMore

Como saber quem são os Administradores de Domínio da sua Rede?

Basics of Full-Stack development: A tool for creating complex application

Basics of Full-Stack development: A tool for creating complex application

Learning on the Job

What Can Therapy Do for You?

Databases: history and use cases (part 2)

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
AirwaveTech

AirwaveTech

Helping you build the hardest parts of your Stack

More from Medium

Filesystem Layouts Supported by Kubernetes

KAS: the GitLab Kubernetes Agent

Use a label to determine whether to forward logs or not with Fluentd daemonset in K8s

Securing a Prometheus Pushgateway deployment on OpenShift