concept GitOps in category kubernetes

appears as: GitOps, GitOps, The GitOps
GitOps and Kuberentes

This is an excerpt from Manning's book GitOps and Kuberentes.

GitOps is a new method of Continuous Deployment that uses Git as a single source of truth for declarative infrastructure and applications, providing both revision and change control. With GitOps, a system is operated by the submission of pull requests (and subsequent merges) to the desired state of the system represented in a Git repository.

Using GitOps with Kubernetes is a natural fit, with the deployment of declarative Kubernetes manifest files being controlled by common Git operations. This brings the core benefits of infrastructure-as-code and immutable infrastructure to the deployment, monitoring, and lifecycle management of Kubernetes applications in an intuitive and accessible way.

In all likelihood, you may already be practicing a fundamental principle of GitOps, which is to store a copy of your application configuration in source control and use it as a “source of truth” of the desired state of your application. You might not be storing it in Git to drive continuous delivery, but to simply to have a copy of the configuration duplicated somewhere, so that the environment can be reproduced (e.g., in a disaster recovery scenario). This copy, for all intents and purposes, can be thought of as the desired application state, and aside from the disaster recovery use case, it serves another useful purpose. It enables operators, at any point in time, to compare the actual running state to the desired state held in source control, and verify that they are matching.

Figure 1.12 Verification of an Environment

The ability to verify your environment is nothing new nor invented by GitOps. But it is a core tenet to GitOps, which has been formalized as a practice. By storing your desired state into one system (i.e., Git), and regularly comparing that desired state with the running state, you unlock an entirely new dimension of observability. Not only do you have the standard observability mechanisms provided by your provider, but you are now able to detect divergence from the desired state.