Bootstrapping GitOps Agents
Tags: kubernetes, gitops
Published: 2022-12-20 15:52:22

---
title: Bootstrapping GitOps Agents
published: true
date: 2022-12-04 11:47:54 UTC
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zx4j1zd0elmu7f2mjt9a.jpg
tags: Kubernetes, GitOps
series: Bootstrapping GitOps Agents
canonical_url: https://windsock.io/bootstrapping-gitops-agents/
---

Since the term was [originally coined](https://www.weave.works/blog/gitops-operations-by-pull-request) back in 2017 by Alexis Richardson (CEO of Weaveworks), the GitOps philosophy has struggled to find a coherent, consensual definition. This fostered some ambiguity, and occasionally some contradiction. For example, [push-based deployments](https://www.gitops.tech/#push-based-vs-pull-based-deployments) were once categorised as a valid approach to GitOps deployments, [but now they're not](https://www.linkedin.com/feed/update/urn:li:activity:6988163333044527104?utm_source=share&utm_medium=member_desktop). There was going to be a common [GitOps engine](https://github.com/argoproj/gitops-engine/blob/master/specs/design.md) for the good of the community, and [then there wasn't](https://fluxcd.io/flux/migration/faq-migration/#is-the-gitops-toolkit-related-to-the-gitops-engine). Flux was in the vanguard of software tools that exemplified GitOps, and then it needed to be [rewritten from the ground up](https://fluxcd.io/flux/migration/faq-migration/#why-did-you-rewrite-flux). And, so on. 

It's encouraging, then, that the last 12 months or so have seen a gradual maturing of the concept, with a [common understanding](https://opengitops.dev/) of what we mean by the term 'GitOps'. And the community has started working together across competing technologies, all under the umbrella of the Cloud Native Computing Foundation (CNCF). Some of the tooling has even acquired '[graduated](https://www.cncf.io/projects/#maturity-levels)' project status with the CNCF. All is good in GitOps land.

As the work to define standards has unfolded, and the development of software tools to meet those standards has ensued, one aspect of GitOps has consistently bugged me. It's an implementation detail that doesn't seem to get a lot of attention.

## GitOps Agents

First, let's briefly outline what a GitOps agent is in the context of a Kubernetes cluster. A GitOps agent is a software application that (at least in part) implements the Kubernetes [controller pattern](https://kubernetes.io/docs/concepts/architecture/controller/), and is responsible for reconciling the declared 'desired state' with the actual cluster state. That is, the Kubernetes configuration for an application stored in a version control system (VCS), is periodically fetched and applied to the cluster, resulting in automated deployments. Change is initiated through the VCS, and explicitly not through direct, imperative change in the cluster. This allows application deployments to be managed using the inherent control features of the hosting VCS (i.e. pull or merge requests).

## Chicken or the Egg

So, GitOps agents allow us to automate application installs and updates in a Kubernetes cluster, according to the [GitOps principles](https://opengitops.dev/#principles). But, aren't the agents themselves, software applications? They might be controllers, but they're still just software applications, requiring; installation, update, reconfiguration, recovery, and so on. This begs the question, how do GitOps agents get deployed to a cluster? Can they be deployed to a cluster according to GitOps principles, like the apps they manage? Can they be used to manage themselves? Seemingly, this is an example of the classic [chicken or the egg](https://en.wikipedia.org/wiki/Chicken_or_the_egg) paradox!

If we have to manually install or update a GitOps agent, then it's deployment is open to all of the issues that the GitOps principles seek to resolve; ambiguous state, configuration drift, unsolicited change, and much more. This effectively makes the state of the whole system as frail as if there were no GitOps agent at all. To that end, it's crucial that GitOps solutions address this problem head on, and provide a means for bootstrapping their agents, whilst allowing for their ongoing management, in line with the GitOps principles that underpin the whole approach.

This is the first article in a brief series looking into the different approaches taken to the bootstrapping conundrum.

## Up Next

The two leading projects in the GitOps domain (arguably), Flux and ArgoCD, go about bootstrapping in different ways. First, we'll discuss how the Flux project [goes about bootstrapping](https://dev.to/nbrownuk/bootstrapping-flux-2m2n) its numerous controllers, and then we'll lift the lid on ArgoCD, to see [how it gets things done](https://windsock.io/bootstrapping-argocd/).