Why GitOps Is Becoming Important For Developers

Source: analyticsindiamag.com

When we look back into the history of web operations, it required a server room with people handling all the hardware. We had to plan well ahead to buy enough hardware to be able to scale applications. There were rules to access the server rooms and other security measures such as firewalls. It involved manual deployments and infra management. 

Then we saw the rise of DevOps, which was a major buzzword in the industry. Now, there is a new term called GitOps, which is ruling the microservices and container-based platforms. 

Before getting into what GitOps is, we know Git is a distributed version control system where developers can manage the source code of their applications. It has text files, certificate files or configuration files which can be maintained inside Git. Developers also use it for collaborating with different members in the team, and efficiently manage code. Now, looking at the Ops part, the term comes from DevOps which is used to release, deploy, operate and monitor code as a part of the operations. 

The Rise Of GitOps

GitOps is the operational practice which uses Git as a single source of truth. It is to be noted that source control repository on Git becomes thesource of truth and not the actual servers or the clusters etc. This is nothing but having your infrastructure as a code, which means all your infrastructure setup is inside a codebase. It also includes the automation of deployments, rollbacks and more. Git repo can be leveraged for version controlling system, peer-reviewing system, automating and deploying process for the production environment. 

Using Git itself, developers are now doing continuous delivery and automated pipelines. Additionally, the webhooks from the Git can be leveraged to push these configurations into the Dev and test environments. Once you merge that particular pull request onto the main branch, the deployment to production happens. 

How GitOps Is Maintained

GitOps allows automating everything using pipelines and deploying that to production once you merge the code into your production branch. It is called GitOps because all the configurations are managed in the Git repository. 

Many developers deploy the infrastructure code as well as a part of their automation process by using only one repository for an application or a service and have a separate repository for each of them. Let’s say you have ten microservices that basically means you have ten GitOps repositories which will have the infrastructure code. Moreover, GitOps demand that developers have separate branches for each environment.

Let’s say you have three environments, namely dev, test and prod, there should be three branches — dev, test and prod. This is done to map each of these branches to different environments in the Kubernetes cluster. Once you push the changes on to that particular branch, there will be a relevant automated pipeline which will be set up. This means that whenever there is a change for that specific branch, the pipeline deploys to that environment. It also identifies, tests and verifies that the environment looks all right.  

This way when a developer makes a change in their dev branch and once the dev branch succeeds, they will be able to merge pull requests in order to join it to the production branch. And once you click on merge, that is when it will deploy to the production environment. If you want to do a rollback, you can create another pull request to roll back to that particular previous state of the branch. 

So, if a user goes and changes the code in the Git repository, it creates a container image, and that container image is pushed to the container registry which is updated into a config updater. Once you create a pull request to merge to a different branch, that is when it deploys to the concerned branch, and then it tests whether these are good. 

This way every time you raise a pull request you know what you are merging and that the pull request is being reviewed by somebody based on the success criteria of that particular automated branch pipeline. This is how GitOps helps teams in solving the automation problem. 

Related Posts

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Artificial Intelligence