Site icon TechiHaus

A Getting Started Guide to GitOps

A Getting Started Guide to GitOps
2024-01-25 16:00:00

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.
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

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

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.

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

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

[Contact Techihaus for get solution for your startup]

Source link

Exit mobile version