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

Diamond operator for Anonymous Inner Classes

So Easy MicroPython — ESP8266/ESP32 MCU File Management

AWS Data Migration — Best Practices

AWS Boto3: S3 Introduction(Part 1)

Multiple deployments using a single code base

How to Turn Gmail Into Your Default Emailing App

set-gmail-default-email-app-allow-in-chrome

LINUX: Commands

Azure Multi-Stage Pipeline for Asp.Net Core and Azure, Deploy to Azure App Service

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

Envoy proxy -the Modern network load balancing and proxying

Progressive Delivery with Canary Deployment (with Flagger and Istio)

Hashicorp-Vault Audit logs using NewRelic

Kubernetes Opaque Secret