Installing ArgoCD in your Kubernetes cluster is a straightforward process. This guide will walk you through the steps to get ArgoCD up and running so you can start managing your applications using GitOps principles.
Prerequisites
Before you begin, ensure that you have the following:
- A Kubernetes Cluster: You need access to a running Kubernetes cluster. This can be a local cluster (like Minikube or kind) or a remote one (like GKE, EKS, AKS, etc.).
- kubectl: The Kubernetes command-line tool must be installed and configured to interact with your cluster.
- Helm (optional): If you prefer to install ArgoCD using Helm, you should have Helm installed.
Step 1: Install ArgoCD
There are two main ways to install ArgoCD: using kubectl
or using Helm
. We’ll cover both methods.
Method 1: Installing with kubectl
- Create the ArgoCD Namespace:
kubectl create namespace argocd
- Apply the ArgoCD Install Manifest:
Download and apply the ArgoCD install manifest from the official ArgoCD repository:
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
This command will deploy all the necessary ArgoCD components into the argocd
namespace.
Method 2: Installing with Helm
If you prefer to use Helm, follow these steps:
- Add the ArgoCD Helm Repository:
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
- Install ArgoCD with Helm:
Install ArgoCD in theargocd
namespace using the following Helm command:
helm install argocd argo/argo-cd --namespace argocd --create-namespace
Step 2: Access the ArgoCD API Server
After installation, you need to access the ArgoCD API server to interact with the ArgoCD UI or CLI.
- Expose the ArgoCD Server: By default, ArgoCD is not exposed outside the Kubernetes cluster. You can access it using a
kubectl port-forward
command.
kubectl port-forward svc/argocd-server -n argocd 8080:443
Now, you can access the ArgoCD UI at https://localhost:8080
.
- Retrieve the Admin Password: The initial admin password is stored in a Kubernetes secret. To retrieve it, run:
kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 --decode; echo
This command will display the admin password, which you can use to log in to the ArgoCD UI.
Step 3: Log In to ArgoCD
- Open the ArgoCD UI:
Open a browser and navigate tohttps://localhost:8080
. - Log In:
- Username:
admin
- Password: Use the password retrieved in the previous step. After logging in, you’ll be taken to the ArgoCD dashboard.
Step 4: Configure ArgoCD CLI (Optional)
The ArgoCD CLI (argocd
) is a powerful tool for managing applications from the command line.
- Install the ArgoCD CLI:
Download the latest ArgoCD CLI binary for your operating system from the ArgoCD releases page. Alternatively, you can usebrew
(for macOS):
brew install argocd
- Login to ArgoCD using the CLI: Use the CLI to log in to your ArgoCD instance:
argocd login localhost:8080
Use admin
as the username and the password you retrieved earlier.
Step 5: Deploy Your First Application
Now that ArgoCD is installed, you can start deploying applications.
- Create a Git Repository:
Create a Git repository containing your Kubernetes manifests, Helm charts, or Kustomize configurations. - Add a New Application in ArgoCD:
- Use the ArgoCD UI or CLI to create a new application.
- Specify the Git repository URL and the path to the manifests or Helm chart.
- Set the destination cluster and namespace. Once configured, ArgoCD will automatically synchronize the application state with what is defined in the Git repository.
Conclusion
ArgoCD is now installed and ready to manage your Kubernetes applications using GitOps principles. By following these steps, you can quickly get started with continuous delivery and automated deployments in your Kubernetes environment. From here, you can explore more advanced features such as automated sync, RBAC, multi-cluster management, and integrations with other CI/CD tools.