What is GitOps?
GitOps is a set of practices to manage infrastructure and application configurations using Git, an open source version control system. GitOps works by using Git as a single source of truth for declarative infrastructure and applications.
GitOps uses Git pull requests to automatically manage infrastructure provisioning and deployment. The Git repository contains the entire state of the system so that the trail of changes to the system state are visible and auditable.
GitOps is built around the developer experience and helps teams manage infrastructure using the same tools and processes they use for software development. Other than Git, GitOps gives you the ability to choose the tools you need.
Weaveworks is credited with creating the term GitOps.
To get started with GitOps you need infrastructure that can be declaratively managed. Because of this, GitOps is often used as an operating model for Kubernetes and cloud native application development and can enable continuous deployment for Kubernetes.
But using Kubernetes is not a requirement of GitOps. GitOps is a technique that can be applied to other infrastructure and deployment pipelines.
Like Kubernetes, Ansible is a desired state engine that enables declarative modeling of traditional IT systems and can therefore be used for GitOps. An Ansible user can manage applications on Kubernetes, on an existing IT infrastructure, or across both through one control plane using Ansible modules.
GitOps can be used to build development pipelines, code applications, manage configurations, provision Kubernetes clusters, and deploy on Kubernetes or container registries.
GitOps can be considered an evolution in Infrastructure as Code (IaC) that uses Git as the version control system for infrastructure configurations. IaC often follows a declarative approach to infrastructure management by defining the desired state of the system and tracking the system’s actual state.
As with IaC, GitOps requires you to declaratively describe the desired state of the system. By using declarative tools, all of your configuration files and source code can be version controlled in Git.
CI/CD pipelines are usually triggered by an external event, like code being pushed to a repository. In a GitOps workflow, changes are made using pull requests which modify state in the Git repository.
To roll out a new release using a GitOps workflow, a pull request is made in Git, which makes a change to the declared state of the cluster. The GitOps operator, which sits between the GitOps pipeline and the orchestration system, picks up the commit and pulls in the new state declaration from Git.
Once the changes are approved and merged, they will be applied automatically to the live infrastructure. Developers can continue to use their standard workflow and continuous integration/continuous delivery practices.
When using GitOps with Kubernetes, the operator will often be a Kubernetes Operator.
The operator compares the desired state in the repository to the actual state of the deployed infrastructure. The operator will update the infrastructure whenever a difference is noticed between the actual state and what exists in the repository. The operator can also monitor a container image repository and make updates in the same way to deploy new images.
Observability, which refers to any system that can be observed, is an important concept in GitOps. Observability in GitOps lets you ensure that the desired state and the observed state (or actual state) are the same.
Using pull requests and a version control system like Git introduces visibility into the deployment process. It lets you view and track any changes made to a system, provides an audit trail, and gives you the ability to rollback changes if something breaks.
GitOps workflows can increase productivity and the velocity of development and deployments, while improving the stability and reliability of systems.
GitOps and DevOps do share some of the same principles and goals. DevOps is about cultural change and providing a way for development teams and operations teams to work together collaboratively.
GitOps gives you tools and a framework to take DevOps practices, like collaboration, CI/CD, and version control, and apply them to infrastructure automation and application deployment.
Developers can work in the code repositories they already know, while operations can put the other necessary pieces into place.
Red Hat® OpenShift® is a declarative Kubernetes platform that administrators can configure and manage using GitOps principles. Working within Kubernetes-based infrastructure and applications, consistency can be applied across clusters and development lifecycles. Red Hat OpenShift consolidates the administration and management of applications spread across on-premise and public cloud resources.
Red Hat OpenShift GitOps is a Red Hat OpenShift operator that uses Argo CD, Red Hat OpenShift Pipelines CI/CD tool, and other tooling to enable teams to implement GitOps workflows for cluster configuration and application delivery.
Red Hat Advanced Cluster Management for Kubernetes provides multicluster management of the Kubernetes cluster lifecycle. Red Hat Advanced Cluster Management uses a subscription and channel framework, along with placement rules, to automatically deploy applications in a desired state model across multiple clusters.
Red Hat Ansible Automation Platform is a desired state engine that enables declarative modeling of systems. Ansible Playbooks, written in YAML, describe the desired state of your systems, which are usually kept in source control. Red Hat Ansible Automation Platform does the work of getting your systems to the desired state, no matter their current state.
With Ansible Automation Platform you can apply GitOps practices to traditional IT systems, like networking, cloud, and bare metal, in addition to Kubernetes. Automation webhooks are built into Ansible Automation Platform to support IaC and GitOps practices.
Webhooks allow you to link a Git repository and Ansible Automation Platform natively. Once a repo link is set up, Ansible Automation Platform catches Git commits from the Git system and uses those events to trigger automation jobs to update projects, manage inventories, and perform deployments.
With the integration of Red Hat Advanced Cluster Management, Red Hat OpenShift GitOps, and Red Hat Ansible Automation Platform, DevOps teams can ensure configurations are managed and maintained at scale to improve CI/CD pipelines.