Kubernetes is declarative, in other words, every component is described in the kube-apiserver as manifests. It makes sense to store this configuration in a version control system like Git. This idea brought us Gitops, where every change is done via a git push command. Everything as code is the new normal.
This article describes the advantages of Gitops with ArgoCD
When first starting with Kubernetes you’ll learn to apply manifests using kubectl. A very popular approach is to use an URL as a manifest, this allows very complex configurations to be installed with a single command. Everything required for the installation is included in this URL, it’s almost magic.
Installation is fine, but what about managing the state of the cluster? How do you keep track of versions etc.?
The problem with static manifests
Sooner or later you’ll realise that static manifests are hard to manage, how do you know that the installation is still in the original state? What if we add stuff that is not in the manifest? Recept for disaster right?
Wouldn’t it be nice if the manifest in the URL would be checked with the state of the cluster every 5 minutes?
ArgoCD manages Kubernetes manifests
With ArgoCD you can configure a Git repository as the source for your manifests. ArgoCD will notice changes in this Git repository and it can be configured to perform actions when this occurs. Better yet, a new cluster could use this same Git repository and configuration would take minimal effort.
Git as a central point of truth for your Kubernetes manifests is rock solid
We appreciate the Gitops workflow for this reason, it’s very easy to create a new cluster that conforms to your configuration and keeping it in sync with changes is done automatically. Combine this with Helm and you’ll start to see the added value.
But Mike, are there any Gitops challenges?
Glad you ask! There are some challenges when working with Gitops. Mostly are related to storing secrets in Git. Since Kubernetes ‘secrets’ are not encrypted, you’ll need to use inline encryption like SOPS, this requires an additional step in the workflow.
Another weak point is the fact that it’s currently hard to define manifests with parameters. Imagine you want to apply a manifest 4 times with 4 different values, this would require that you define values in each manifest. (Flux does this a little bit better than ArgoCD)
Flux or ArgoCD?
Another fine Gitops tool is Flux. Flux however, comes without a web interface and is perhaps a bit more strict in terms of Gitops principles (installing Flux is done via Gitops). For this reason we recommend ArgoCD, it will get you started with Gitops in no-time!
Next post will contain a hands-on session with ArgoCD.