Managing kubernetes application using GitOps 2
Utilizing ArgoCD and Git to manage Kubernetes applications on one or more clusters
From our previous article Managing kubernetes application using GitOps (ArgoCD), we were able to completely setup and expose ArgoCD to manage all application on our K8s cluster.
In this article, we will be adding our applications to our ArgoCD setup to effectively manage them.
ArgoCD uses git and various other tools to manage your K8s configuration files but we will be focusing on Kustomize.
Kustomize provides a solution for customizing Kubernetes resource configuration free from templates and DSLs. There are other alternative tools for managing K8s resources.
Reference
We will substitute the following words with their defined shortcuts.
- Kubernetes - K8s
Prerequisites
To effectively follow through in this guide, you should have completed all processes from Managing kubernetes application using GitOps (ArgoCD).
You should also be familiar with Kustomize and how to use it to manage you K8s configuration.
Adding Git Repository
We have completely setup our ArgoCD installation to manage our applications, let us go ahead and add the git repositories(if more than one) containing our application configuration files to ArgoCD.
Login into ArgoCD, in the dashboard, select Settings from the side menu.
Inside the Settings page, select Repositories from the list.
Under Repositories, there are various ways to connect to our git repositories, we will choose any convenient method to add the repository containing our configuration files to ArgoCD.
We have successfully added our K8s configuration repository to ArgoCD but it cannot start managing our applications because we have not imported or created any application(s) using the repository. Let us proceed to add our existing application(s) to ArgoCD for effective management.
Create App Using Git Repository
Navigate to the Applications from the side menu. In the application page, click on the *New App button.
Fill in the content of the form. There are some few tips to note:
The name of our app must be in lowercase and must not contain any space (for multiple word names)
Select default from the Project selection
Sync Policy should be Manual
For existing apps already running, from the Sync Options, check Apply Out Of Sync.
Select our repository and choose the folder path containing our K8s configuration files
Select the Cluster from the list (was added in the previous guide) and enter the namespace (if we desire)
Click on the Create button and we will find a new app on the Applications page.
Sync App To Cluster
After creating our app on ArgoCD, there are possibilities of our app displaying the Out Of Sync label which means it is not fully connected to our app on the cluster.
To solve this, Click on the Sync button on the app card and watch everything fall in place.
Now we have successfully setup our application management infrastructure using gitOps tools ( Git, ArgoCD and Kustomize), We can go ahead to manage as many applications as we desire.