Gitops vs DevOps: What are the differences?
Lately, I have been learning a lot around GitOps in the home lab and have seen tremendous benefits from taking this approach with my environment. However, have you wondered what the difference is between GitOps vs DevOps? The differences can be subtle but they are important, especially in production environments and dealing with compliance and other concerns. Let’s take a look at the difference.
Table of contents
GitOps vs DevOps comparing the two
There can be confusion between the two and some might think that you either adopt a DevOps approach or you adopt a GitOps approach to development and your pipeline. However, GitOps is actually more of an extension of DevOps than it is a replacement for it. DevOps is much more broad in its focus compared to the GitOps approach. It can include a wide range of things, including both CI/CD, governance, observability, and more. DevOps may or may not use Git as a central source of truth for managing the configurations in the environment.
GitOps on the other hand is focused on delivery. It uses a Git repository as the single source of truth. The changes made by GitOps are declarative and these are automatically applied to the system using Kubernetes operators and CI/CD pipelines.
DevOps deployment can use a wide variety of tools, including Jenkins or another CI/CD tool, monitoring like Prometheus and Grafana, and configuration management like Ansible or Chef. It can deploy to various container orchestration technologies like Kubernetes or Docker Swarm. It does not exclusively rely on Git.
When it comes to securing your development environment, with GitOps, the repo becomes the audit trail for all changes that allows for better traceability and rollback operations. When you control access to Git, you are essentially controlling access to modify the infrastructure. DevOps security is more distributed across different platforms, so it is more difficult to secure.
Looking at deployment differences
In the DevOps deployment scenario, let’s look at the workflow that may be used for this approach. Note the following:
- A developer writes their code
- Code is committed to a Git repository
- It triggers a Jenkins CI process
- The CI process may do unit testing, build container images, and push the image to a container registry
- It can also connect with Kubernetes environments to push the manifests and deploy apps to the K8s environment
In the GitOps it starts very similarly but deviates from DevOps approach after the Jenkins CI is triggered:
- A developer writes their code
- Code is committed to a Git repository
- It triggers a Jenkins CI process
- It pushes to the container registry
- You have an agent installed in Kubernetes to scan and pull container registries for new images
- You can also extend your pipeline to update the Kubernetes manifest and then raise a pull request
- Once approved it will pull the updated manifests and apply them to Kubernetes cluster
Do you choose one or the other?
Contrary to what some might think, GitOps isn’t necessarily a totally different “thing” compared to DevOps, or GitOps vs DevOps. In other words, they are complementary methdologies. DevOps is the more broad and spacious approach to modern infrastructure. GitOps is a more specific method that focuses in on the deployment and makes the git repository the source of truth opposed to anything else.
Kubernetes is more important with GitOps
I also think that Kubernetes is front and center to a GitOps approach, especially on-premises as many of the solutions that are commonly used for GitOps purposes use Kubernetes underneath the hood. Two examples of solutions that are commonly referenced for GitOps are:
Both of these deploy into Kubernetes clusters and then deploy your applications by monitoring Git repositories and then syncing up the Kubernetes clusters based on code changes in the manifests in your Git repo.
So another consideration is if you have Kubernetes in the mix. If you are using a more traditional Docker environment or even with Swarm, you will probably be looking at a more traditional DevOps approach for development and deploying your infrastructure.
However, Kubernetes will give you the ability for an easier approach to GitOps since there are already solutions out there that provide this functionality like ArgoCD and FluxCD.
GitOps in Cloud Environments
While I have been focused more on on-premises GitOps in the home lab and production environments, you can also use GitOps in cloud environments. GitOps in cloud environments will use a combination of tools like infrastructure as code tools. These include the very familiar tools like Terraform, Pulumi, or something like AWS CloudFormation.
You can also use things like continuous delivery tools in cloud environments as well. Flux and ArgoCD can both be used to deploy resources in cloud native applications. Flux can even have its controllers deployed in cloud infrastructure.
There are also platform specific tools that can be used for GitOps operations in cloud environments. Note the following:
- AWS CodePipeline & CodeDeploy: these tools automate deployments based on Git changes.
- Google Cloud Deployment Manager: Used in GitOps pipelines for managing Google Cloud resources.
- Azure DevOps: Has pipelines and native IaC tools (e.g., ARM templates, Bicep) that support GitOps practices.
More traditional DevOps tools also have plugins and other features that can also be used in conjunction with cloud environments.
- Jenkins with GitOps plugins: You can use this for git workflows for both on-premises and cloud resources.
- GitHub Actions: Changes in a Git repository can trigger deployments, including those that are in cloud deployments.
- GitLab CI/CD: You can run your GitOps in cloud environments, allowing you to apply changes to cloud infrastructure as part of a pipeline.
Wrapping up
These are just a few of the differences between GitOps vs DevOps. Rather than being competing methdologies when it comes to development and deploying your infrastructure, they are complementary and offer very similar paths to deploying code. GitOps is definitely the preferred way with Kubernetes centric infrastrucdture and allows having a single source of truth and other advantages for compliance (secrets handling) and other things. I encourage you as part of your learning path at the end of 2024 and into 2025 to get familiar with DevOps and GitOps principles and tools and start playing around with these in your home lab environment.