Home Cd store Testing automated Kubernetes deployments, a GitOps advantage

Testing automated Kubernetes deployments, a GitOps advantage

1
0

When you think of Kubernetes deployments, the first thing that usually comes to mind is: how can I automate this? In a world filled with automation and DevOps-centric tools, manually deploying an application to Kubernetes is a tedious process for developers.

For a team of software engineers to remove the manual footprint from their Kubernetes deployments, they must embrace GitOps. Let’s see how testers can use GitOps to test their Kubernetes environments.

What is GitOps?

In its most basic form, GitOps is like configuration management. Configuration management was originally designed so that multiple servers connect to a back-end server to retrieve configuration information, such as how to install an application or service like SQL Server that runs a script for a some automation. The ultimate goal was to ensure that the services always had the same configuration running and that the configurations were exactly what the engineer expected.

GitOps is a way to automatically deploy and define exactly what developers want to run in Kubernetes. This could range from Kubernetes deployments to services or whatever workload you choose to run on a Kubernetes cluster.

The main server – as in configuration management – is a Git-based source control system. As such, this means that the code in, say, a GitHub account, is the source of truth for what a team needs to deploy to Kubernetes. Kubernetes is then configured to have an interval checker that examines GitHub every, say, five minutes, and confirms that what’s running on Kubernetes is what’s in source control. If not, Kubernetes attempts to retrieve the code configurations from source control.

At a high level, developers can use GitOps to ensure that Kubernetes runs applications, services, and / or deployments exactly as the development team expects.

GitOps tools

When it comes to the tools engineers can use to test their automated deployments on Kubernetes, there is no shortage of vendor or open source options for setting up a GitOps environment. Three popular options include:

  • Stream CD
  • CD Argo
  • Weaving GitOps

Developers new to GitOps tend to choose Stream CD. Flux CD is a GitOps operator and works as a deployment application on a Kubernetes cluster. The project is used to synchronize manifests from a Git-based source control system – like GitHub – to ensure that what is running on the Kubernetes cluster is what is in the GitOps manifests. Stream CD ensures that the Kubernetes cluster is running the correct applications from Git by monitoring Kubernetes manifests to see if any changes occur. If a change occurs, Flux CD deploys the new changes to the Kubernetes cluster.

Argo CD is a continuous delivery and deployment tool specially configured for GitOps. This controller is declarative in nature, which means that it describes what deployments do, not how they do it. Within the tool itself, Argo CD also has synchronization capabilities to ensure that the Kubernetes cluster is running the specific applications and Kubernetes manifests declared in source control. The tool is like Flux CD with its synchronization features, but Argo CD has better functionality with its multi-cluster deployment management. Argo CD also has a user interface that developers can use to manage deployments.

Weave offers a free open source option called GitOps Core as well as a paid version called GitOps Enterprise. Similar to Argo CD, Weave GitOps Core is an open source continuous delivery tool used to deploy Kubernetes applications. The enterprise version provides a management console / UI, collaboration with teams, and additional security features.

Getting started with GitOps testing

Before teams begin GitOps testing, they will need the following four components:

First, the team will need a Kubernetes cluster. Testers can use GitOps on any type of Kubernetes cluster, such as AKS in Azure or EKS in AWS. If the team is running Kubernetes on-premises or managing the master and worker nodes themselves, testers can use GitOps with that as well. If a running Kubernetes cluster has a resource available to deploy any of the aforementioned GitOps tools / platforms, that will also work.

Once the Kubernetes cluster is operational, testers will then need to configure a Git-based source control system. The source control system is where the team will store Kubernetes manifests for deployments, services, entries, etc. Testers who want to get started with a free Git-based source control system should consider GitHub.

Next, the team will need to decide which GitOps system they want to use. For example, if he chooses Stream CD, team members will need to go through the installation setup to deploy the tool to the Kubernetes cluster. Once the tool is deployed to Kubernetes, it will continuously check the Git-based source control system to confirm Kubernetes manifest configurations.

When the Kubernetes cluster, source control, and the GitOps tool are configured, a team member will need to create a Kubernetes manifest. The Kubernetes manifesto can be for any application. Additionally, the Kubernetes website provides an Nginx example.

Once all of this is set up, testers on a team can run GitOps testing to ensure that Kubernetes manifests in source control deploy and sync correctly with a Kubernetes cluster.