Skip to main content

4 min read

Get GitOps off the ground and prepare for common challenges

Vanessa Whiteley
Vanessa Whiteley
16 December 22 DevOps
Get GitOps off the ground and prepare for common challenges
What is GitOps?

To clear up any confusion, GitOps is an operational framework applied to infrastructure and configuration automation. It incorporates software development lifecycle best practices so teams can easily manage infrastructure using the same tools and processes they know well, including:

  • Collaboration
  • Version control
  • Continuous delivery/deployment (CD)
  • Compliance

GitOps leverages Git – an open-source distributed version control system that helps developers coordinate when they’re working on the same code. And it follows a branch, code, check, merge (or pull request) workflow to develop the codebase.

There’s a GitOps operator that sits between your code (Git) and your infrastructure (Ops). Its job is to pick up the binaries mapped to a commit and pull in the new state declaration from Git.

With Git as the single source of truth, GitOps automated processes alert your teams if there's a change, triggering automatic infrastructure deployments or rollbacks to converge on the state stored in Git.

Why is GitOps great? It saves developers time, builds stability, and can mean huge cost savings for your business.

How do you put GitOps into practice?

If GitOps sounds like the framework for you, the first step is to design and implement best-practice processes for your infrastructure team to stick to and bring new solutions on board. This is the ideal time to turn to external experts while making the most of existing knowledge within your organisation and offering training to bring your people up to speed.

You'll need to decide whether to have a dedicated pipeline for infrastructure changes, integrate them into one of your existing pipelines, or use a hybrid approach. A dedicated pipeline is ideal for managing infrastructure at scale and allows your DevOps team to start from scratch, implementing the infrastructure that makes the most sense without any restrictions.

Integration with an existing pipeline might work better for smaller teams, where GitOps is only used in specific instances. Yes, it's more restrictive, but with CI/CD foundations already in place, you'll be extending the pipeline rather than reinventing the wheel. Most likely, you'll take a hybrid approach, maximising the scalable benefits of dedicated pipelines with the flexibility of integration.

copy_text Icon
Copied!
GitOps with GitLab: The bigger picture

GitOps with GitLab: The bigger picture

Explore the benefits of utilising GitOps through GitLab to truly do everything as code, with more automated interactions and increased clarity of process.

Watch now
Core components of GitOps

Next, there are three core components you'll need to incorporate into your workflow:

IaC

This is the practice of keeping all your infrastructure and/or configurations stored as code. You'll need a Git repository to track any changes made to a project.

Pull requests

These are the change mechanisms used for infrastructure updates in GitOps. It's how teams come together to collaborate and how approvals happen. Merging an approved pull request promotes the updated infrastructure definition, and a GitOps operator will pull those changes to update the environments as necessary.

CD

Your pipeline needs to apply the state changes to your environment continuously. GitOps automation can roll back the changes to the previous working version if there are errors. If manual changes get made, it can enforce the desired state of the environment based on the declared configuration in source control.

Picking a platform

Other than using Git, you don't need a specific product or platform to do GitOps. There are dedicated GitOps tools like WeaveWorks Flux and Argo CD, but if you want a bit more bang for your buck, you might consider using a larger software development tool like GitLab. We think it's a cut above the competition when it comes to infrastructure automation. And we're not alone. GitLab is used by some of the world's largest engineering teams too.

GitLab's agile planning and code review help you foster collaboration between your infrastructure, ops, and dev teams. With version control, source code management, and CI/CD in one application, it's a seamless experience designed to keep your people productive. You can frequently deploy with the confidence of a stable, reliable, secure software environment.

Some of GitLab's capabilities include the following:

  • Git-based version control to make reproducible environments and roll back to the last known working states after incidents occur.
  • Code review to improve code quality and catch errors before they go live.
  • Protected branches so everyone can contribute to share repositories, but special permission is required to deploy to production.
  • Powerful and scalable CI/CD.
  • Integration with your Terraform state file.
  • Deployment where you want, whether that's containers or VMs.
copy_text Icon
Copied!
Common challenges with GitOps

Even with the best tools in your stack, GitOps will be a big change for your teams, so be prepared to come up against some challenges. Remember, you need a mature DevOps culture for GitOps to work well, and even then, it won't solve all your problems. Here are a few potential pitfalls to keep in mind.

Collaboration doesn't always come easy

The GitOps approval process requires developers to create a request after making a code change, and then an approver merges the change before it's deployed. People who think this is long-winded might still try to make changes manually or directly in production.

It's about infrastructure and deployment only

GitOps will not impact how you compile codes, run tests, take care of security, or analyse your SDLC. It applies to one part of the life cycle – infrastructure and deployment. You can't rely on it to fix problems elsewhere.

You need to be using Git

For GitOps to work, you have to create pull requests in Git. There's a clear assumption that you and your teams are already using Git and pull requests. If not, there's a steep learning curve, especially when it comes to colleagues with zero experience with both.

Bigger isn't always better

Larger organisations might struggle with the sheer volume of repositories, environments, and applications they need to stay on top for GitOps to work well. They also need to ensure everyone across the business is keeping clear records of their pull requests and issues, which can be tricky. Using a dedicated tool like Argo CD can help. It provides a separate UI to look at all your GitOps-enabled repositories, letting you make changes automatically.

GitOps workflows can be complex

The more environments you have, the more complex your application and its infrastructure becomes. The same goes for managing repositories across multiple apps with multiple environments. You'll need to consider your repository set-up, where people make changes, and who's responsible.

copy_text Icon
Copied!

Get GitOps up and running with Adaptavist

As we’ve explained, GitOps is challenging to set up and see succeed. That’s why it pays to have the experts by your side.

As a Select GitLab partner, Adaptavist is proud to deliver end-to-end DevOps services and solutions for our customers using the best tools on the market. We can help with GitOps implementation, strategic guidance, assessments, and even training your teams. Find out how easy getting GitOps up and running can be today.

copy_text Icon
Copied!

Get in touch


About the authors

Vanessa Whiteley

Vanessa Whiteley

Partner Marketing Manager