---
title: "A Getting Started Guide to GitOps"
description: "Embark on your GitOps journey—seamless, automated, and efficient. Explore the power of GitOps for streamlined workflows in this tutorial!"
canonical: "https://adamtheautomator.com/gitops/"
---

# A Getting Started Guide to GitOps

> Embark on your GitOps journey—seamless, automated, and efficient. Explore the power of GitOps for streamlined workflows in this tutorial!

Source: https://adamtheautomator.com/gitops/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![A Getting Started Guide to GitOps](https://adamtheautomator.com/wp-content/uploads/2024/01/gitops.jpg)

# A Getting Started Guide to GitOps

[![](https://secure.gravatar.com/avatar/4857309ffa2757ccd895816d23abcbed03b21a0557487e69114a512023cfc095?s=192&d=mm&r=g)Deborah Emeni](https://adamtheautomator.com/author/deborah-emeni/)25 January 20246 min. read

Categories: [DevOps](/category/devops/)

Tags:[DevOps](/tag/devops/)[Git](/tag/git/)[GitHub](/tag/github/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Exploring the Essence of GitOps](#exploring-the-essence-of-gitops)
*   [Verifying a Kubernetes Cluster for Setting Up a GitOps Scenario](#verifying-a-kubernetes-cluster-for-setting-up-a-gitops-scenario)
*   [Installing the Flux CLI and Granting Flux Permissions](#installing-the-flux-cli-and-granting-flux-permissions)
*   [Bootstrapping Flux in the Kubernetes Cluster](#bootstrapping-flux-in-the-kubernetes-cluster)
*   [Conclusion](#conclusion)

Getting caught in the tangle of Kubernetes management is a familiar struggle, where orchestrating deployments becomes a web of complexities. If the need for a solution to streamline your Kubernetes workflows resonates with you, say hello to ‘GitOps.’

In this tutorial, you’ll unveil a powerful antidote to the common deployment headaches. Let GitOps emerge as the strategic solution to untangle your Kubernetes intricacies.

Confidence, control, and a newfound mastery over your infrastructure await!

## Prerequisites

Before immersing yourself in this tutorial, ensure you’ve got the following prerequisites to follow along seamlessly:

*   [Docker daemon](https://docs.docker.com/config/daemon/) running.
*   Kubernetes Command-Line ([kubectl](https://kubernetes.io/docs/tasks/tools/)) installed.
*   Kubernetes Cluster with [kind](https://kind.sigs.k8s.io/) already running.
*   A GitHub [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with repo and user permissions.

## Exploring the Essence of GitOps

As a developer, you’re most likely familiar with version control systems (VCS) like Git, which you use to keep track of changes in your code. Now, GitOps is a process centered around using Git as the backbone for managing infrastructure and deploying applications.

Instead of manually setting up and managing your infrastructure components, GitOps uses configuration files stored in Git repositories. This approach is particular but not restricted to Kubernetes-based environments.

These benefits include enabling your team to improve version control, traceability, and collaboration in your development and operations workflows. But mind you, your team may encounter some drawbacks, like [compatibility issues and a complex setup](https://www.microtica.com/blog/gitops-issues).

![Illustrating how GitOps works](https://adamtheautomator.com/wp-content/uploads/2024/01/image-178.png)

Illustrating how GitOps works

GitOps falls under the DevOps umbrella but differs in tool usage. How? GitOps commonly utilizes tools like Kubernetes, specific Git-driven CI/CD pipelines, and [Infrastructure as Code (IaC) tools](https://adamtheautomator.com/infrastructure-as-code-iac/).

Related:[Infrastructure as Code (IAC) in DevOps Pipelines](https://adamtheautomator.com/infrastructure-as-code-iac/)

In contrast, DevOps encompasses a broader range of tools and practices, including GitOps, without being tied to a specific tool like Git.

![Illustrating how GitOps falls under DevOps](https://adamtheautomator.com/wp-content/uploads/2024/01/image-177.png)

Illustrating how GitOps falls under DevOps

## Verifying a Kubernetes Cluster for Setting Up a GitOps Scenario

Coming straight from exploring the essence of GitOps, you’ll now set the stage for a robust GitOps implementation — verifying a Kubernetes cluster.

Setting up a GitOps scenario involves implementing a workflow and tooling for infrastructure and application deployment management.

To verify a Kubernetes cluster, follow these steps:

1\. Open a terminal, execute the following `kind` command to get all available Kubernetes clusters, and confirm you have an active one.

```bash
kind get clusters
```

In this tutorial, one cluster called **sample-kind** runs, as shown below.

![Confirming an active Kubernetes cluster](https://adamtheautomator.com/wp-content/uploads/2024/01/image-181.png)

Confirming an active Kubernetes cluster

The cluster’s configuration establishes a connection between the local environment and the Kubernetes cluster.

```yaml
# Define a Kubernetes cluster using kind
kind: Cluster  
# Specify the Kubernetes API version for kind
apiVersion: kind.x-k8s.io/v1alpha4  
# Name of the cluster
name: sample-kind  
nodes:
# Single node with the role of a control plane
- role: control-plane  
  kubeadmConfigPatches:
  - |  # Kubernetes administrative configurations applied during initialization
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        # Set a custom label for the node indicating it is ready for ingress
        node-labels: "ingress-ready=true"
      extraPortMappings:
        # Map container port 80 to host port 80 with TCP protocol
        - containerPort: 80
          hostPort: 80
          protocol: TCP
        # Map container port 443 to host port 443 with TCP protocol
        - containerPort: 443
          hostPort: 443
          protocol: TCP
```

2\. Next, run the [`kubectl`](https://kubernetes.io/docs/reference/kubectl/) command below to [`get`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get) all `nodes` available.

```bash
kubectl get nodes
```

As shown below, the output displays information about individual nodes that make up your Kubernetes cluster.

![Viewing all available nodes](https://adamtheautomator.com/wp-content/uploads/2024/01/image-180.png)

Viewing all available nodes

3\. Lastly, run the below command to `get` all running `services` to ensure your service is deployed on your Kubernetes cluster.

```bash
kubectl get services
```

As in the output below, you’ll see the list of your services.

![Listing all services](https://adamtheautomator.com/wp-content/uploads/2024/01/image-179.png)

Listing all services

## Installing the Flux CLI and Granting Flux Permissions

After confirming your Kubernetes cluster runs, you can set up your GitOps Scenario. This process involves installing a GitOps tool and granting permissions to access your private Git repositories.

This tutorial’s choice for a GitOps tool is [Flux CD](https://fluxcd.io/) or Flux, an open-source continuous delivery tool. This tool monitors your Git repositories for changes in your Kubernetes manifests and automatically syncs the state you declared to the desired state in your Kubernetes cluster.

Before interacting with Flux, you must install the Flux CLI, which provides commands and functionalities.

> 💡 _Note: This tutorial uses Flux because it has a large community and simpler setup and documentation than other tools._

Related:[Actionable Kubernetes GitOps with FluxCD](https://adamtheautomator.com/fluxcd/)

To install Flux CLI and grant Flux permissions, carry out the following:

1\. Run the `brew` command below to `install` Flux CLI on your system.

```bash
brew install fluxcd/tap/flux
```

> 💡 _Explore the official documentation for instructions on [installing the Flux CLI](https://fluxcd.io/flux/cmd/) if you’re on a system other than macOS. The Flux CLI is also conveniently offered as a binary executable that is compatible with all major platforms (visit the [GitHub releases page](https://github.com/fluxcd/flux2/releases))._

2\. Once installed, execute the following commands to `export` your GitHub username and personal access token.

These commands have no output but grant Flux access to your private Git repositories. Thus, replace the `<personal access token>` and `<username>` placeholders accordingly.

These exports allow Flux to consistently observe your Git repositories for modifications and autonomously initiate updates in response to code changes. This functionality guarantees that your Kubernetes cluster aligns with the desired state defined in your Git repository.

```bash
export GITHUB_TOKEN=<personal access token>
export GITHUB_USER=<username>
```

3\. Now, run the following `flux` command to `check` your Kubernetes cluster is suitable for Flux.

This command checks for compatibility, detects issues, and verifies tools and permissions.

```bash
flux check --pre
```

If the checks pass, you’ll see an output similar to the one below.

![Checking the Kubernetes cluster is suitable for Flux](https://adamtheautomator.com/wp-content/uploads/2024/01/image-182.png)

Checking the Kubernetes cluster is suitable for Flux

## Bootstrapping Flux in the Kubernetes Cluster

With Flux installed and your cluster validated, you must ensure Flux is seamlessly integrated into your Kubernetes environment. You’ll bootstrap Flux in your Kubernetes cluster and connect it to your Git repository for a smoothly operating Kubernetes environment.

To bootstrap Flux in your Kubernetes cluster, perform the following:

1\. Execute the `flux bootstrap` command below to perform the following and install Flux on your Kubernetes cluster:

*   `bootstrap github` – Indicate the bootstrap process is initiated with GitHub as the source for configuration and deployment.
*   `--owner` – Specify the owner of the GitHub repository, which you exported to the `$GITHUB_USER` variable.
*   `--repository` – Define the name of your existing GitHub repository (in this case, `flux-sample`).
*   `--branch` – Specify the branch to use within your GitHub repository for the Flux configuration (i.e., `main`).
*   `--path` – Denote the path within your GitHub repository where the Flux configuration files are located (i.e., `clusters/sample-kind`).
*   `--personal` – Suggest using personal access credentials for authentication with the GitHub repository.

```bash
flux bootstrap github \
--owner=$GITHUB_USER \
--repository=flux-sample \
--branch=main \
--path=clusters/sample-kind \
--personal
```

Before you dive deeper, look at the following illustration to understand the typical GitOps workflow.

When you make changes via pull requests to your Git repository, like updating Kubernetes cluster configuration, the pipeline triggers a GitOps tool. That tool (i.e., Flux, Argo CD, Jenkins X, and so on) can be used to implement the GitOps workflow.

![Illustrating GitOps workflow](https://adamtheautomator.com/wp-content/uploads/2024/01/image-186.png)

Illustrating GitOps workflow

2\. Once bootstrapping is complete, visit your GitHub repository to verify your configuration files, as shown below.

![Verifying the configuration files in the GitHub repository](https://adamtheautomator.com/wp-content/uploads/2024/01/image-185.png)

Verifying the configuration files in the GitHub repository

3\. Next, run the following `k9s` command to check the flux-system has been installed on your Kubernetes cluster.

`k9s` is a command-line interface (CLI) tool that provides a terminal-based graphical user interface (TUI) for interacting with Kubernetes clusters. This tool offers a more user-friendly and intuitive way to navigate and manage Kubernetes resources than raw `kubectl` commands.

```bash
k9s
```

4\. Now, type `:ns` to enter the command mode and view the list of installed namespaces, select the **flux-system** namespace, and hit Enter. Doing so lets you switch to the flux-system namespace, switching the `k9s` context to operate within that specific namespace.

![Viewing the list of namespaces installed in the Kubernetes cluster ](https://adamtheautomator.com/wp-content/uploads/2024/01/image-184.png)

Viewing the list of namespaces installed in the Kubernetes cluster

Related:[A Getting Started Guide to Kubernetes Namespaces](https://adamtheautomator.com/kubernetes-namespaces/)

In the output below, you’ll see some controller pods installed automatically during the Flux bootstrap process. By viewing the controller pods, you can confirm the components and controllers required for Flux are running.

Congratulations! You’re now using the `k9s` tool to inspect the state of your Kubernetes cluster.

![Viewing the controller pods installed and running on the flux-system namespace](https://adamtheautomator.com/wp-content/uploads/2024/01/image-183.png)

Viewing the controller pods installed and running on the flux-system namespace

## Conclusion

In this insightful journey of getting started with GitOps, you’ve embarked on a transformative exploration of orchestrating Kubernetes environments with Git at the helm. From understanding the fundamental principles of GitOps to setting up a practical scenario, you’ve learned the ropes and taken concrete steps toward a more efficient and streamlined workflow.

After diving into bootstrapping Flux in your Kubernetes cluster, you’ve unlocked the ability to manage your IaC seamlessly. This triumph marks the beginning of a more controlled and collaborative era.

Equipped with this newfound knowledge, why not extend your expertise by exploring advanced GitOps tools like Argo CD? Or fine-tune your CI/CD pipeline integration and dive deeper into Kubernetes orchestration?

The journey doesn’t end here; it evolves with every commit, deployment, and improvement!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fgitops%2F&text=A%20Getting%20Started%20Guide%20to%20GitOps)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fgitops%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fgitops%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/08/featured_image-5.webp)

### [Azure DevOps Boards: Trace Every Commit to Deployment](/azure-devops-boards-traceability/)

Configure Azure DevOps Boards process templates, backlogs, and Kanban WIP limits, then trace every work item from commit to deployment.

![](https://adamtheautomator.com/wp-content/uploads/2024/12/featured-image-8.webp)

### [Creating Custom GitHub Actions: A Complete Guide for DevOps Teams](/custom-github-actions-guide/)

Learn how to build custom JavaScript GitHub Actions to share standardized, reusable code across your organization's workflows. This hands-on tutorial walks through creating authentication and secret management actions.

![](https://adamtheautomator.com/wp-content/uploads/2021/04/Contributing-to-GitHub-Projects-Git-Pull-Requests-for-Dummies.jpg)

### [Contributing to GitHub Projects (Git Pull Request for Dummies)](/git-pull-request/)

Learn how to contribute to GitHub projects by issuing Git pull requests to work with GitHub repo owners in this step-by-step article.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
