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:
helm fetch ` --repo https://fluxcd.github.io/flux ` --untar ` --untardir .\.charts ` --version 0.10.2 ` flux
helm template flux ` --set git.url="email@example.com:cmendible/kubernetes.samples" ` --set git.path="19.flux" ` --set git.pollInterval="5s" ` --namespace flux ` --output-dir .\.baked .\.charts\fluxcd
kubectl apply -f .\.baked\flux\templates\
Download the fluxctl CLI
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.
Hope it helps!