GitOps is a set of practices for managing infrastructure and application configurations to expand upon existing processes and improve the application lifecycle.
ArgoCD is a declarative, GitOps continuous delivery tool for Kubernetes. It does this by comparing the config repo to desired state.
Benefit
- Declarative GtOps Tool
- Kubernetes Native Continous Deployment
- Disaster Recovery
- Control Multiple Clusters
Prerequisites
- Kubernetes
- Configuration Repository
Here is the common pipeline that companies to use with ArgoCD
Setup ArgoCD
Create namespace and apply the argocd manifest installation file
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Access ArgoCD GUI
kubectl port-forward service/argocd-server -n argocd 8080:443
then goto localhost:8080
username: admin
to get password
, you need to go back to command line and type
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
now you will see the dashboard
Example
Now, I will show you how to use ArgoCD in a small helm chart project.
Usually, there are at least 2 repos for application
and deployment
.
In this example, I have a nodejs repo
and a k8s repo
.
in application repo
in k8s repo
Workflow
1.Add k8s repo to ArgoCD to monitor when it is changed to update the deployment
complete the detail of the app and repo
click create
2.When user commit or merge to main
branch, the github action will build the new docker image and push it to dockerhub
3.After push successfully, the same pipeline will update the image tag number in k8s repo
4.ArgoCD detects the change in k8s repo and apply the new manifest from the repo
Code used in this article
Keep Learning
Leave a comment if you have any questions.
===========
Please keep in touch
Portfolio
Linkedin
Github
Youtube