Learn how automated agents reconcile drift in systems managed by GitOps.

In GitOps, automated agents like Flux perform two crucial activities that manage system operations. First, automated agents automatically apply changes to the system's runtime when developers commit changes to the desired state, as we have explored. Once the desired state is applied, automated agents ensure that the system continues to conform to it through a process known as reconciliation.

Functions of automated agents in GitOps include:

  • Automated deployment of changes to the system's desired state.

  • Reconciliation of the runtime and desired states to eliminate drift.

During reconciliation, the automated agents correct the runtime state of the system if it deviates or drifts away from what is specified in the desired state. Reconciliation is possible because the automated agents observe both the desired state stored in Git and the runtime state of the system, which allows them to converge the runtime state back into conformance with the desired state when drift occurs. This can allow systems managed with GitOps to self-heal when they might enter into an incorrect state.

Reconciling drift

To see the reconciliation process in action, let's introduce some drift into the Kubernetes cluster running within the interactive widget. Once the cluster drifts, we'll observe how the automated agent converges the system back to its desired state upon detecting the deviation between the desired state and the system's runtime state.

Inspect the system runtime state

To begin, launch the interactive terminal, which will provision the Kubernetes cluster with Flux installed and configured to deploy a new version of the sample Python application. If we inspect the /system/infrastructure/deployment.yaml file within the terminal, we can view the update to the desired state on line 17 where it specifies the container image of kmbeducative/python-sample:2.0. We can test the new version of the application by running the following command with curl:

Get hands-on with 1200+ tech skills courses.