0% found this document useful (0 votes)
21 views

Using ArgoCD for Kubernetes Deployments

Uploaded by

suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Using ArgoCD for Kubernetes Deployments

Uploaded by

suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Using ArgoCD for Kubernetes Deployments

ArgoCD is a powerful GitOps tool used to manage Kubernetes (K8s) deployments. It provides versioning,
tracking, and synchronization between your Git repositories and Kubernetes clusters, ensuring that
deployments match their desired state while preventing unwanted or malicious changes.

Why Use ArgoCD?

1.​ Version Control and Tracking:​

○​ By storing manifest files in a Git repository, ArgoCD tracks changes and maintains
version control.
○​ This approach ensures that deployments are consistent and auditable.
2.​ Automation:​

○​ ArgoCD automatically synchronizes changes from Git to Kubernetes clusters, removing


the need for manual deployment steps or shell scripts.
3.​ Security and Reliability:​

○​ ArgoCD monitors for discrepancies between the desired state (defined in Git) and the
current state (in the cluster) and resolves them automatically.
4.​ Key Features:​

○​ Supports multi-cluster environments.


○​ Includes a web UI and CLI for easy access and management.
○​ Enhances scalability and provides security controls.

Core Concepts of ArgoCD

●​ Git Repository:
○​ Syncs with GitHub or any Git-compatible repository.
●​ Application Controller:
○​ Ensures synchronization between Git repositories and Kubernetes clusters.
●​ Self-Healing:
○​ Automatically reverts undesirable changes in the cluster to the desired state.

Installing ArgoCD

Follow these steps to install and set up ArgoCD:

Create a Namespace:​

kubectl create namespace argocd

1.​
Install ArgoCD: Use the official manifest file to install ArgoCD:​

kubectl apply -n argocd -f


https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

2.​

Verify Installation: Check the created resources:​

kubectl get all -n argocd

3.​
4.​ Access the Web UI:​

Patch the argocd-server service to expose it via a LoadBalancer:​


kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

○​

Get the LoadBalancer URL:​


kubectl get svc -n argocd

○​
○​ Open the URL in a browser and proceed to the login page.
5.​ Login to ArgoCD:​

○​ Use the default admin username (admin).

Retrieve and decode the initial admin password:​


kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64
--decode

○​
○​ Log in using these credentials.

Setting Up an Application

1.​ Create a New Application:​

○​ Add an application name and project name.


○​ Configure the sync policy to enable self-healing.
○​ Specify the destination cluster URL and namespace (e.g., dev).
2.​ Connect to a Git Repository:​

○​ Provide the GitHub repository URL.


○​ Define the path to the manifest files.
3.​ Synchronize and Deploy:​

○​ ArgoCD will automatically synchronize the application and deploy it to the cluster.

Verify deployment with:​


kubectl get all -n dev

○​
4.​ Monitor and Update:​

○​ Any updates to the manifest files in the repository will trigger an automatic sync.
○​ View deployment history and events in the ArgoCD web UI.

Advantages of ArgoCD

●​ Simplifies CD lifecycle with GitOps principles.


●​ Provides robust tools for monitoring, auditing, and managing cluster states.
●​ Ensures consistency across multi-cluster setups.
●​ Offers both CLI and web UI for comprehensive management.

Conclusion

ArgoCD is an essential tool for modern Kubernetes deployments. By adhering to GitOps principles, it
ensures reliability, security, and efficiency in managing Kubernetes clusters. For more details, refer to the
official ArgoCD documentation.

You might also like