3v-Hosting Blog

What is GitOps?

Administration

13 min read


If you've ever caught yourself thinking that infrastructure has a life of its own, and that production somehow differs from staging for no apparent reason, then you've already encountered the classic problem of change management. Servers were configured manually, configurations were changed “on the fly,” and the real reasons for the discrepancies were long lost in the annals of history.

GitOps emerged as a response to this chaos. It is not just another buzzword from the DevOps lexicon, nor is it just another way to deploy applications. GitOps is a comprehensive approach to infrastructure and application management that makes changes predictable, reproducible, and, most importantly, explainable.

At the heart of GitOps is a simple but radical idea: that Git becomes the single source of truth for everything from Kubernetes cluster configuration to service launch parameters. No magic on servers, no manual edits - everything that affects the system must be described in the repository.

 

 

 

 

How the idea of GitOps came about

GitOps did not appear suddenly and was not invented from scratch. It was a logical continuation of several already established practices that gradually converged with each other.

First, infrastructure as code (IaaC) appeared. Teams began to describe servers, networks, load balancers, and clusters in the form of configuration files. This allowed for automated deployment, but did not solve the problem of change control. Configurations could be applied manually, with different tools, and at different times.

CI/CD processes developed in parallel. Application code lived in Git, underwent review, testing, and delivery. However, infrastructure often remained out of focus and was managed by its own separate accesses, scripts, and manual operations.

But at some point, it became clear that if Git was great at managing code, change history, and auditing, why not use it as the central element for managing the entire system?

This is how several key ideas came together:

  • Git as a reliable version control and history system;
  • a declarative description of the desired state of the system;
  • automation of change application;
  • constant reconciliation of how things should be with how they actually are.

As a result, Git ceased to be just a code repository and became the operational center of the infrastructure.

 

 

 

 

The essence of GitOps in simple terms

To better understand what GitOps is, it is helpful to think of infrastructure as a building blueprint. In the classic approach, an engineer can make adjustments directly on the object, on the construction site, for example, replace the type of cable, change the settings of automatic circuit breakers, or change the number of lighting points. As a result, the building continues to stand, but after a few months, no one will remember what changes were made and, more importantly, why.

GitOps practice introduces a strict rule that there should be no manual edits. Any change is first described in Git as a commit, after which an automated system brings the actual state of the infrastructure into line with the description. As a result, the entire system becomes manageable through code rather than manual actions.

Ultimately, GitOps can be reduced to the basic principles described above, which are worth repeating:

  • the desired state of the system is described declaratively;
  • Git is the single source of truth;
  • automated agents themselves apply and maintain this state.

 

How these principles look in real infrastructure

In practice, this means that the repository stores not only the source code of applications, but also all their launch parameters, i.e., manifests, configurations, access policies, and network rules. Any change goes through a pull request, is discussed, and is recorded in the history.

After that, a special agent within the infrastructure compares the current state of the system with what is described in Git and eliminates any discrepancies. If something has been changed manually, the system automatically returns to the reference state by rolling out the version of the application that is committed in git to the server.

 

 

 

 

GitOps and Kubernetes. Why they are often mentioned together.

Although GitOps principles are applicable outside of container platforms, it was Kubernetes that made this approach truly mainstream. The reason is that Kubernetes is originally built on a declarative management model.

In Kubernetes, you don't describe the step-by-step process of launching a service. You describe how it should look in its final state, and the platform itself takes care of achieving that state. And GitOps fits perfectly with this philosophy.

In the GitOps model for Kubernetes:

  • YAML manifests are stored in a Git repository;
  • the cluster is constantly checked against the reference state;
  • any discrepancies are automatically corrected.

 

If someone manually deletes a pod, changes the configuration, or shuts down a service, the system itself will return everything to the state described in Git. It's like autopilot, where you can try to intervene in the control, but the system automatically stabilizes itself.

 

A typical GitOps workflow in Kubernetes

At the conceptual level, the GitOps process in Kubernetes looks quite simple, but behind this simplicity lies an important feature: the cluster does not accept commands from outside, but monitors itself to ensure that its state matches that described in Git. This fundamentally distinguishes GitOps from classic deployment models.

In simplified form, the GitOps flow looks like this:

  • changes are made to the Git repository in the form of edits to YAML manifests or Helm templates;
  • the commit passes code review and enters the main branch, becoming the new reference state of the system;
  • The GitOps agent inside the cluster regularly polls the repository and detects changes;
  • The agent applies the new state, bringing Kubernetes resources into line with the description;
  • The cluster constantly checks with Git and automatically corrects configuration drift.

The key point here is constant state verification, not a one-time deployment, because even after successfully applying changes, the system continues to ensure that the actual configuration does not deviate from the specified one. If resources are deleted or changed manually, the GitOps agent will restore them based on the repository, keeping the infrastructure in a predictable and manageable state.

 

 

 

 

 

How GitOps differs from classic CI/CD

At first glance, GitOps may seem like a variation of CI/CD, but the differences here are fundamental and affect the very architecture of the processes, since in the traditional CI/CD approach, the pipeline itself connects to servers or clusters. It stores accesses, tokens, and secrets, and deployment occurs as if “from CI to the outside.”

In the GitOps model, everything is arranged differently.

Criterion Traditional CI/CD GitOps
Who initiates the deployment CI system Agent inside the infrastructure
Where access credentials are stored In CI Inside the cluster
Security model External access to the infrastructure Minimal attack surface
Rollback mechanism Scripts or manual actions Commit revert
State control One-time deployment Continuous reconciliation

 

This approach significantly reduces the attack surface and makes the system more secure. CI ceases to be the owner of the infrastructure and becomes only a source of changes.

 

 

 

 

GitOps as a control and audit tool

One of the most underrated but important advantages of GitOps is its transparency. When infrastructure is managed through Git, any changes are automatically documented, which allows you to track all actions that led to a problem, for example, when investigating incidents.

You can always answer key questions:

  • Who made the changes?
  • When did it happen?
  • What exactly was changed?
  • Can it be quickly rolled back?

 

By the way, rolling back looks almost comically simple: revert commit:) Instead of complex recovery scenarios and nighttime incident analysis, you simply return to the previous state.

 

An example from real-world operation

Now imagine a situation where a new release breaks some functionality. In the classic approach, you start searching for logs, comparing configurations, and trying to remember what changed.

In the GitOps model, everything is much simpler. You simply see the specific commit that changed the configuration, roll it back, and get a predictable result. Downtime is reduced from hours to minutes.

 

 

 

 

GitOps in the real work of DevOps teams

In fact, in real projects, GitOps is rarely used as a separate practice for application deployment. More often than not, it becomes the framework for the entire platform, around which development, operation, and scaling processes are built. In essence, Git becomes the assembly point for all changes that affect the operation of the system.

GitOps is used in such projects to manage not only applications, but also key infrastructure elements, such as:

  • cloud resources and basic infrastructure;
  • Kubernetes clusters and their configuration;
  • ingress settings, balancing, and network rules;
  • service launch and scaling parameters;
  • test, staging, and production environments.

 

Importantly, GitOps provides a unified approach to all these levels. Whether it's adding a new service, changing routing rules, or updating the production configuration, the process is always the same: the change is recorded in Git, verified, and becomes part of the system's baseline state.

This approach creates a clear division of responsibilities within the team. Developers work with application code and declarative manifests without having direct access to clusters. DevOps engineers are responsible for the platform, standards, and basic templates, and Git becomes the intersection of all processes and roles.

This is especially important for startups and digital businesses. GitOps reduces operational chaos, speeds up releases, and reduces dependence on specific individuals, because when knowledge about the system is recorded in the code and change history, the infrastructure ceases to be a “black box” and becomes a manageable asset of the company.

 

 

 

 

Where GitOps performs particularly well

GitOps maximizes its advantages in environments where infrastructure is developing rapidly and the number of changes is constantly growing. In such conditions, manual management and informal processes very quickly lead to the accumulation of technical debt and loss of control over the system.

GitOps has the most noticeable effect in the following scenarios:

  • distributed teams, where development and operation are carried out from different locations and time zones;
  • multiple environments with the same architecture but different parameters and access levels;
  • frequent releases and regular configuration changes;
  • microservice systems with a large number of components;
  • increased requirements for platform stability and predictability.

 

In all these cases, GitOps acts as an engineering discipline that sets uniform rules of the game. It does not speed up processes in some “magical way” - it simply prevents the infrastructure from degrading into a set of random solutions accumulated in a hurry. This allows the system to remain manageable even as the team grows and the project becomes more complex.

However, there are cases where using GitOps may be unnecessary or not as effective.

 

 

When GitOps may be excessive

Despite its effectiveness, GitOps is not a universal solution for all tasks. In very small projects or teams without an established culture of working with Git, this approach may seem overly burdensome.

If the infrastructure is minimal, changes are rare, and environments are almost identical, implementing GitOps can create additional overhead.

 

New rules, processes, and discipline requirements emerge that are not always justified in the early stages.

However, it is important to understand that these limitations are temporary. As the system grows and the number of services and team members increases, GitOps often ceases to be redundant and begins to solve real problems. This is why many teams do not adopt it immediately, but only after the first serious incidents or project scaling.

 

 

 

 

Frequently asked questions about GitOps

 

Is it necessary to use Kubernetes for GitOps?

No. Kubernetes is simply the best fit for GitOps due to its declarative model and built-in mechanism for bringing the state to the desired state. However, the GitOps approach itself is not exclusively tied to Kubernetes and can be used to manage virtual machines, cloud resources, or service configurations if they are described declaratively and can be applied automatically.

 

Can GitOps be implemented gradually?

Yes, in fact, gradual implementation is the most common and practical scenario. Usually, you start with a single environment or a separate component, such as a test cluster or support services. This allows the team to adapt to the processes without creating an excessive load on the existing infrastructure.

 

Do you need a separate repository for infrastructure?

It depends on the scale of the project and the team structure. In small systems, infrastructure manifests can be stored alongside the application code. In medium and large projects, a separate repository is usually justified: it simplifies access control, improves readability, and helps divide responsibilities between teams.

 

Is GitOps suitable for small teams?

Yes, if the team is ready to follow basic Git and pull request discipline. Even in small teams, GitOps helps to capture infrastructure knowledge and avoid situations where everything depends on one person. The main thing is not to complicate processes prematurely.

 

How does GitOps affect infrastructure security?

GitOps generally increases security. External CI systems no longer require direct access to clusters or servers, and all changes go through Git with history and review. This reduces the attack surface and simplifies auditing.

 

What happens if Git is unavailable or the repository is temporarily unavailable?

In most GitOps implementations, the infrastructure continues to operate in its current state. The agent simply won't be able to get new changes until access to the repository is restored. This doesn't cause services to stop, but it does highlight the importance of reliable storage and backup of repositories.

 

Do you need to train your team before implementing GitOps?

Yes, although training is usually straightforward. GitOps requires an understanding of Git, pull requests, and the basic principles of declarative infrastructure. The investment in training quickly pays for itself through fewer errors and more predictable changes.

 

 

 

 

Conclusions

GitOps is not a set of tools or another layer of automation on top of existing processes. First and foremost, it is an approach to infrastructure management that shifts control, responsibility, and transparency to code and processes rather than manual actions and individual knowledge.

From an engineering practice perspective, GitOps helps eliminate one of the main problems of modern infrastructure: the discrepancy between how a system should work and how it actually works. Declarative state descriptions, a single source of truth, and automatic reconciliation allow you to maintain predictability even in complex and rapidly changing environments.

For DevOps teams, GitOps means less manual routine, easier rollbacks, clear auditing of changes, and a clearer division of responsibilities. Infrastructure ceases to be a “black box” and becomes a system whose behavior can be explained and easily reproduced.

From a business perspective, GitOps reduces operational risks, speeds up releases, and reduces dependence on individual specialists. When knowledge about the platform is recorded in Git and backed up by processes, team or product growth ceases to be a threat to stability.

It is important to understand that GitOps does not solve all problems automatically and requires a certain amount of discipline. However, in projects where infrastructure complexity and change frequency are constantly increasing, this approach ceases to be redundant and becomes a natural stage in the evolution of the project.

If we consider infrastructure as a product rather than a by-product of development, GitOps is one of the most practical ways to start managing that product consciously, systematically, and for the long term.

How do IP addresses work?
How do IP addresses work?

Learn how IP addresses work: IPv4 vs IPv6, public and private IPs, DNS resolution, routing, security basics, and how IPs are used in real server and cloud infra...

12 min