
How to Install ArgoCD for GitOps in Kubernetes
How to Install ArgoCD for GitOps in Kubernetes
ArgoCD is a declarative, GitOps continuous delivery tool for Kubernetes. It provides you with automated deployments, synchronization with Git repositories, and version tracking of your applications. In this guide, we will walk you through the installation of ArgoCD.
Prerequisites
- Access to a Kubernetes cluster. If you don’t have one already, consider setting up a cluster using a provider like Google Kubernetes Engine (Official site) or Amazon EKS (Official site).
- A basic understanding of Kubernetes and GitOps principles.
- kubectl installed and configured on your local machine.
Step-by-Step Installation
Step 1: Install ArgoCD CLI
First, install the ArgoCD Command Line Interface (CLI) on your local machine. The CLI is available for various operating systems:
# For macOS using Homebrew
brew install argocd
# For Windows using Chocolatey
choco install argocd
# For Linux
sudo curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo chmod +x /usr/local/bin/argocd
Step 2: Deploy ArgoCD in Your Cluster
To deploy ArgoCD, execute the following command:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
This installs all necessary components, including the ArgoCD server, repositories, application controller, and the user interface.
Step 3: Access the ArgoCD UI
After deployment, ArgoCD’s UI can be accessed. By default, the server will be exposed as a Kubernetes service of type ClusterIP. To access it externally, port-forward the ArgoCD server service:
kubectl port-forward svc/argocd-server -n argocd 8080:443
Visit http://localhost:8080 in your web browser.
Step 4: Retrieve the Initial Admin Password
Retrieve the initial password for the admin account which is automatically generated:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
Step 5: Login to ArgoCD
Log in using the ArgoCD CLI:
argocd login localhost:8080
argocd login <ARGOCD_SERVER> --username admin --password <PASSWORD>
Replace <ARGOCD_SERVER>
with your server address and <PASSWORD>
with the password you retrieved.
Troubleshooting Installation
- If the application doesn’t sync, ensure the repository’s URL and credentials are correct and accessible.
- Verify Kubernetes resources were not blocked by Network Policies or RBAC settings.
- For authentication failures, double-check the password of the
argocd-initial-admin-secret
.
Conclusion & Summary
Successfully installing ArgoCD sets the foundation for deploying applications in a GitOps model, providing enhanced management and monitoring of your Kubernetes deployments. For managing Kubernetes, other tools like OPA Gatekeeper can be integrated for extended policy control.
Checklist
- Ensure kubectl is configured properly
- Deploy ArgoCD into a namespace
- Access the ArgoCD UI and configure your first application