GitOps: Deploying apps in Azure Kubernetes Service (AKS) with Flux
Recently I learned about GitOps which is a way to manage your Kubernetes clusters and the applications you run on top using Git. The idea is that you can declaratively describe the desired state of your systems in Git and roll out changes as soon as merges occur.
You can immediately see the main benefits of such an approach: Your Git repositories become the single source of truth for both your infrastructure and application code, allowing the teams to increase productivity and stability (you get the Git log to audit changes).
To implement GitOps you can use and configure Flux following some simple steps:
1. Download the helm template
helm fetch ` --repo https://fluxcd.github.io/flux ` --untar ` --untardir .\.charts ` --version 0.10.2 ` flux
2. Bake the template with your repo (I don’t use Tiller)
helm template flux ` --set git.url="[email protected]:cmendible/kubernetes.samples" ` --set git.path="19.flux" ` --set git.pollInterval="5s" ` --namespace flux ` --output-dir .\.baked .\.charts\fluxcd
3. Deploy the configuration to your cluster
kubectl apply -f .\.baked\flux\templates\
4. Get the fluxctl CLI
Download the fluxctl CLI
5. Use fluxctl to get the public key
fluxctl identity --k8s-fwd-ns flux
This key is needed to sync your cluster state with the Git repository (GitHub): Copy the key you obtained and use it to create a deploy key with write access on your GitHub repository (Settings > Deploy keys > Add deploy key > check Allow write access > paste the Flux public key > click Add key)
You are all set. If everything runs smooth you’ll find a new deployment in your cluster with the dni-function name.
To learn more about GitOps check: Weaveworks
Click here to learn more about Flux
Hope it helps!