DEV Community

Cover image for πŸ‘‰ πŸš€ GitOps in Action: Deploy Applications on Kubernetes using Argo CD
Abhishek Korde
Abhishek Korde

Posted on

πŸ‘‰ πŸš€ GitOps in Action: Deploy Applications on Kubernetes using Argo CD

🎀 INTRO
Hi everyone, welcome back to my channel!
Today we’re going to deploy an application using GitOps with Argo CD, one of the most popular continuous delivery tools for Kubernetes.

If you’re learning DevOps or Kubernetes, this is a must-have skill.

🧠 WHAT IS GITOPS?

GitOps is a deployment approach where Git is the single source of truth.
Whatever is written in Git is exactly what runs in the Kubernetes cluster.

Argo CD continuously watches your Git repository and automatically syncs changes to the cluster.


🧰 PREREQUISITES

Before starting, make sure you have:

  • Minikube running
  • kubectl installed
  • A Kubernetes cluster ready

I’m using Minikube on Windows for this demo.


πŸš€ STEP 1: VERIFY MINIKUBE

First, let’s check the Minikube status.

minikube status
Enter fullscreen mode Exit fullscreen mode

As you can see, the control plane, kubelet, and API server are running.


πŸš€ STEP 2: INSTALL ARGO CD

Now we’ll install Argo CD in the Kubernetes cluster.

kubectl create namespace argocd

kubectl apply -n argocd \
-f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Enter fullscreen mode Exit fullscreen mode

This command installs all Argo CD components like the API server, controller, repo server, and Redis.


πŸš€ STEP 3: VERIFY ARGO CD PODS

kubectl get pods -n argocd
Enter fullscreen mode Exit fullscreen mode

All pods should be in Running state before moving forward.
Note:Wait untill all pods should be running state..


πŸš€ STEP 4: EXPOSE ARGO CD UI
Argo CD runs internally by default, so we need to access it.
check all the service of ArgoCD using below command:

kubectl get svc -n argocd
Enter fullscreen mode Exit fullscreen mode


As you seen in above snapshot, There is *argocd-server * change the service type to NodePort service of argocd-server.

kubectl edit svc argocd-server -n argocd
Enter fullscreen mode Exit fullscreen mode


minikube service argocd-server -n argocd
Enter fullscreen mode Exit fullscreen mode

This gives us the Argo CD UI URL.
But we need to do tunneling the get local ip address of argocd-server.
To do tunneling use below command:

minikube service argocd-server -n argocd
Enter fullscreen mode Exit fullscreen mode

This will give you https and http ip address, using this ip you can use ArgoCD UI.


πŸš€ STEP 5: LOGIN TO ARGO CD
Username is admin.
To get the password:

kubectl get secret -n argocd
Enter fullscreen mode Exit fullscreen mode


to get password, edit the argocd-initial-admin-secret.

kubectl edit secret argocd-initial-admin-secret -n argocd
Enter fullscreen mode Exit fullscreen mode

copy the password.

but this password is encrypted so we need to decrypt it.

[System.Text.Encoding]::UTF8.GetString(

)

Enter fullscreen mode Exit fullscreen mode

This command decrypt the password and give you password from that password we can log in ArgoCD.


πŸš€ STEP 6: DEPLOY APPLICATION USING GITOPS
Now comes the GitOps part.

I already have a Git repository containing Kubernetes manifests like:
**

  • Deployment
  • Service ** In Argo CD UI: **
  • Click New Application
  • Provide Git repo URL
  • Select branch and path
  • Choose destination cluster and namespace
  • Click Create **

Argo CD automatically syncs Git with the cluster 🎯


πŸ”„ AUTO SYNC & DRIFT DETECTION
If someone changes resources manually in Kubernetes, Argo CD detects the drift.

Git always wins β€” that’s the power of GitOps.


βœ… FINAL RESULT
Our application is now deployed successfully using Argo CD.

Any future change pushed to Git will automatically update the cluster.


🎯 CONCLUSION
Argo CD makes Kubernetes deployments:

**- Declarative

  • Version controlled
  • Secure
  • Fully automated**

This is how modern DevOps teams deploy to production.

Top comments (0)