Skip to content

Latest commit

Β 

History

History
264 lines (188 loc) Β· 6.93 KB

File metadata and controls

264 lines (188 loc) Β· 6.93 KB

πŸš€ Managing-Kubernetes-Deployments-with-ArgoCD

Image

πŸ”₯ Introduction

ArgoCD πŸš€ is a powerful, declarative GitOps πŸ”„ continuous delivery tool designed for Kubernetes ☸️, enabling seamless automatic deployment ⚑ and lifecycle management of applications. It ensures that the desired application state, defined in a Git repository πŸ“‚, is automatically synchronized with the actual state in a Kubernetes cluster πŸ—οΈ. This makes deployments more reliable, automated, and version-controlled βœ…. With ArgoCD, teams can achieve real-time monitoring πŸ“Š, rollback capabilities πŸ”„, and multi-cluster management 🌍, enhancing both security πŸ” and efficiency in DevOps workflows.

In this beginner-friendly guide πŸ“–, we will walk through the installation and configuration of ArgoCD on Minikube πŸ’», a lightweight Kubernetes environment ideal for testing and development. We will then demonstrate how to deploy an application πŸš€, monitor its deployment status βœ…, and expose it for external access 🌍. By the end of this guide, you will have a fully functional ArgoCD setup 🎯, understand its key features, and be equipped to manage Kubernetes applications declaratively using GitOps principles πŸ”₯.

This guide is beginner-friendly and covers essential steps in detail. 🎯


βœ… Prerequisites

Ensure you have the following installed:

To verify Minikube installation:

minikube version

βš™οΈ Step 1: Start Minikube

Start your Minikube cluster:

minikube start

Check the status:

minikube status

πŸ“¦ Step 2: Create Namespaces

Create a namespace for ArgoCD:

kubectl create namespace argocd

Create a namespace for applications:

kubectl create namespace argocd-apps

πŸš€ Step 3: Install ArgoCD

Apply the ArgoCD installation manifest:

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

Verify installation:

kubectl get pods -n argocd -w

Check services:

kubectl get svc -n argocd

🌐 Step 4: Expose ArgoCD Server

By default, the ArgoCD server runs as a ClusterIP service. Change it to NodePort:

kubectl edit svc argocd-server -n argocd

Locate type: ClusterIP and change it to type: NodePort. Save and exit.

Expose the ArgoCD server:

minikube service argocd-server -n argocd

You will receive a URL similar to:

http://127.0.0.1:6516

Use this URL to access the ArgoCD dashboard. 🎯


πŸ”‘ Step 5: Retrieve ArgoCD Admin Password

Find the secret containing the initial admin password:

kubectl get secrets -n argocd

Edit the secret file:

kubectl edit secret argocd-initial-admin-secret -n argocd

Decode the base64 password using or any other third party services:

echo <base64-password> | base64 --decode

Use admin as the username and the decoded password to log in.


πŸ“Œ Step 6.1: Deploy Application via ArgoCD(CLI)

1️⃣ Login to ArgoCD CLI:

argocd login <your-minikube-ip>:<argo-port>

2️⃣ Create an Application in ArgoCD:

argocd app create "hello-argocd" \
  --repo https://github.com/argoproj/argocd-example-apps.git \
  --path guestbook \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace argocd-apps

3️⃣ Sync the Application:

argocd app sync "hello-argocd"

4️⃣ Verify Application Status:

kubectl get pods -n argocd-apps

πŸ–₯️ Step 6.2: Deploy Application via ArgoCD (GUI)

1️⃣ Access ArgoCD Web UI:
Open the ArgoCD dashboard in your browser using the URL from Step 4:

http://127.0.0.1:6516
Image

2️⃣ Login:
Use admin as the username and the password obtained in Step 5.

3️⃣ Create an Application:

  • In the ArgoCD dashboard, click on + NEW APP.

  • In the Application Name field, enter

    hello-argocd
  • Set the Project to

    default
  • Under Repository URL, enter

    https://github.com/argoproj/argocd-example-apps.git
  • Set Path to

    guestbook
  • Set Destination Cluster to

    https://kubernetes.default.svc
  • Set Namespace to

    argocd-apps

Click Create to add the application.

Image Image Image

4️⃣ Sync the Application:
Once the application is created, click the Sync button on the application details page to sync the app.

5️⃣ Verify Application Status:
You will see the status of your application under Application Details. Wait until the status shows as Synced and Healthy.

Image Image

🌍 Step 7: Expose the Guestbook Application

Find the service:

kubectl get svc -n argocd-apps

Edit the service to get the NodePort:

kubectl edit svc guestbook-ui -n argocd-apps

Expose the application:

kubectl expose service guestbook-ui --type=NodePort --target-port=80 --name=guestbook-ui-ext -n argocd-apps

Access the application:

minikube service guestbook-ui-ext -n argocd-apps

πŸŽ‰ Your application is now deployed via ArgoCD!

Image

🎯 Conclusion

Congratulations! You have successfully set up ArgoCD on Minikube, deployed an application, and exposed it.

βœ… Key Takeaways:

  • ArgoCD is a GitOps continuous delivery tool for Kubernetes.
  • Applications are managed declaratively from a Git repository.
  • Minikube helps simulate a real Kubernetes cluster for testing.

πŸš€ Next Steps:

  • Explore Argo Rollouts for advanced deployment strategies.
  • Set up RBAC and authentication for ArgoCD security.
  • Deploy a real-world application using ArgoCD.

πŸ”— Useful Links: