Let’s imagine a situation. There is an eCommerce app that’s receiving high traffic during sales. It was observed that the load balancer wasn’t working as expected, thereby affecting the application performance and consumers’ buying experience as well.
To fix this, a new load balancer with an entirely different configuration was deployed. However, instead of resolving the problem, it introduced other issues to the system like traffic management failures and halts in other operations. This happened because the new configuration was incompatible with some of the services within the cluster.
When such situations arise, the development and operations time would want to roll back the older version of the load balancer. This is where the need for GitOps arises.
What is GitOps?
GitOps is a set of practices that helps the DevOps team to manage the infrastructure and application configuration using Git (an open-source version control system).
GitOps leverages the usual development tools to help teams manage cloud-native and clustered applications (such as Kubernetes) using the CI/CD principles. It enables continuous delivery through automated deployment, monitoring, and management of cloud-native applications using Git as a single source of truth.
Apart from bringing agility to the development cycle, GitOps assure that safe and secure changes are executed, even in a complex application. Moreover, if we compare GitOps with a traditional CI/CD pipeline, security remains a major differentiating factor. For example, in a CI/CD pipeline, the developers are required to share the API credentials of their cluster with the CI tooling while GitOps removes this dependency.
The three core principles of GitOps include:
Git as a single source of truth: The teams should use Git as a version control system to manage how the infrastructure evolves and execute the change through a simple pull-request-based workflow.
Infrastructure as a Code: The system infrastructure, right from configuration files to network settings should be declared as a versionable file.
Automation: Not just the application but GitOps helps the DevOps team to automate and manage the infrastructure as well.
How GitOps Works?
Let’s go back to where we started from. At the inception of this blog, we shared a scenario with you and suggested GitOps as a workable solution to it. Here, we take the same scenario for reference and understand how GitOps would have simplified the situation (Note that in this situation, GitOps is already deployed).
There is an eCommerce app that’s experiencing a spike in traffic during the sale. One of the DevOps members (who is working from a different location) realized that the load balancer is not working as expected. So, they checked the GitOps repository to check the infrastructure configuration and found out a file that configures and deploys the load balancer. The member could review the file online and analyze the load balancer configuration that needs to be optimized.
After a load balancer is optimized to handle the traffic on the server. The operator sees the changes in load balancer configuration and the orchestrator automatically deploys the new one. The team then monitors the new state of the system.
Here, instead of creating a new load balancer with a different configuration (which might clash with the system), the same load balancer is updated, ensuring the functionality of the server or the entire system stays unaffected.
GitOps: Understanding the Benefits
a) Increased Productivity
GitOps introduces continuous deployment automation. An integrated feedback control loop means the development and operations team can significantly speed up the meantime to deployment.
b) Reliable Recovery
With GitOps, the DevOps team can revert or roll back the changes at the infrastructure or application level. Here, Git is the single source of truth from where recovery can be done post-disaster. This reduces the meantime to recovery (from hours to minutes).
c) Augment Developer Experience
GitOps gives developers the opportunity to use the tools they are familiar with (Git for application version management) and use it to manage updates/features to Kubernetes (even when they don’t know Kubernetes internally).
d) Consistency and Standardization
With GitOps, the CI/CD pipelines are driven by pull requests. The changes in the app, infra, or Kubernetes are consistently managed through end-to-end workflows.
e) Stronger Security
Git is backed by cryptography for tracking and managing changes. The platform also facilities signing changes to prove authorship.
GitOps for your Next Project?
Considering the advantages, the DevOps team at Daffodil practices GitOps in projects, wherever needed. If your next project is complex, needs frequent releases, demands security, and a better disaster recovery system, then GitOps practices could be the right fit for your project.