What is GitOps and how does it work
· Category: DevOps & CI/CD
Short answer
GitOps uses a Git repository as the single source of truth for infrastructure and application state. An agent in the cluster continuously reconciles the live state with the desired state defined in Git, enabling version-controlled, auditable deployments.
Details
Traditional CI/CD pushes changes to environments. GitOps pulls changes: you commit a manifest change to Git, and tools like Argo CD or Flux apply it to the cluster. This model provides drift detection (the agent reverts manual changes), easy rollbacks (revert a commit), and clear audit trails.
GitOps is most commonly associated with Kubernetes but can apply to any declarative system. If you are new to container orchestration, start by learning How to build a Docker image. For managing the underlying infrastructure definitions, see How to use Terraform for infrastructure as code.
Tips
- Separate application source code from environment configuration into different repositories for cleaner access control.
- Use branch protection and required reviews on environment branches to prevent unilateral production changes.
- For networking considerations in cluster deployments, check out how to configure DNS records for service discovery.