Sobes.tech
Middle

What is the concept of GitOps?

sobes.tech AI

Answer from AI

GitOps is an operational framework that uses Git as a single source of truth for declarative descriptions of the desired state of infrastructure and applications.

Key principles:

  • Declarativeness: The system is described declaratively, for example, using Kubernetes manifests.
  • Versioning: The desired state of the system is stored in Git and has versions.
  • Automation: Automated processes apply changes from Git to the working environment.
  • Reconciliation: Special agents constantly check the actual state of the system and bring it in line with the desired state in Git.

Workflow scheme:

  1. Developer or operator makes changes to the configuration or application code and commits to the Git repository.
  2. The CI/CD system builds artifacts (e.g., Docker images) and updates deployment manifests in another Git repository (configuration repository).
  3. The GitOps agent (e.g., Flux CD, Argo CD) monitors the configuration repository.
  4. Upon detecting a new commit, the agent retrieves the changes and applies them to the target environment (e.g., Kubernetes cluster).
  5. The agent constantly checks whether the current state of the cluster matches the state described in Git and corrects discrepancies.

Advantages:

  • Reliability: The system state can always be restored from Git.
  • Speed: Automated processes enable faster deployment of changes.
  • Security: All changes go through Git, ensuring auditability and rollback capability.
  • Visibility: Change history is available in Git.
  • Simplified rollbacks: Reverting to a previous state is reduced to reverting a commit in Git.

Examples of tools:

  • Flux CD
  • Argo CD