GitOps
About
GitOps is code-based infrastructure and operational procedures that rely on Git as a source control system, that leverages Git as the single source of truth.
You use Git pull requests to verify and automatically deploy system infrastructure modifications.
An evolution of Infrastructure as Code (IaC).
Primarily used with operating models for Kubernetes based infrastructure and applications.
But there are tools coming to market that support direct Terraform manipulation.
Benefits
GitOps shares many of the same benefits as an agle feature branch workflow.
The first major benefit is ease of adoption due to the usage of common tools.
It brings transparency and clarity to an organization's infrastruscture needs around a central repo. It also allows to quickly experiment with new infrastructure configurations. If a new change don't behave as expected, a team can use Git history to revert changes to a known good state.
How it works
To achieve a full GitOps install, a pipeline is required.
ArgoCD, Jenkins, Bitbucket Pipelines or CircleCi. (To automate and bridge the gap between PRs and the Orchestration system)
Once this pipeline hooks are established and triggered from PRs, commands are executed to the orchestration piece.
Example
CI
The CI step will run tests and make sure it should be runnable and will also build the main branch and make a Docker image, by executing the Dockerfile inside the project.
The DOCKER_PASSWORD will be an Access Token generated in DockerHub.
CD
Kubernetes Manifest
We can create the Kubernetes manifest files with kind.
Create this files inside k8s in the infra projects folder.
To get the correct image version, you may use Helm that will handle the package name at runtime??.
Or use Kustomize which will update the deployment.yaml file everytime a change happens.
Every time you want to update the running version, you change the version-sha to the one of the last commit, in kustomize.yaml, and kustomize will behind the scenes update kubernetes.
Will be the agent to keep checking for changes.
It is installed inside Kubernetes.
Last updated