fbpx
How to Deploy ArgoCD on Kubernetes

Let’s get started with deploying ArgoCD on Kubernetes. With the rise of containerization and orchestration technologies, Kubernetes has become the de facto standard for container management. When it comes to Continuous Deployment (CD) in Kubernetes environments, ArgoCD stands out as an impressive tool. Designed specifically for Kubernetes, ArgoCD bridges the gap between continuous integration and continuous deployment in a Kubernetes-native manner. If you’re running k3s and have Helm already in place, you’re already on the fast track!

Prerequisites

Before we get started, let’s review the prerequisites:

  • A Kubernetes cluster. If you don’t already have a Kubernetes cluster, follow our article that helps you setup a Kubernetes cluster using K3s: [The K3s quick start guide]
  • Helm installed on your local machine and configured for your k3s cluster. See the [Helm installation docs]
  • Basic familiarity with Kubernetes and kubectl.
  • ArgoCD CLI: This is optional but will be useful for managing applications.

Deploying ArgoCD on Kubernetes

With Helm in place, you’ll first want to add the ArgoCD Helm repository:

helm repo add argo https://argoproj.github.io/argo-helm
helm repo update

Now that our Helm repository is set up, we can proceed with deploying ArgoCD on Kubernetes:

helm install argocd argo/argo-cd -n argocd --create-namespace
How to Deploy ArgoCD on Kubernetes

Post-installation, you would want to access the ArgoCD on Kubernetes dashboard. Expose the ArgoCD Server service:

kubectl port-forward svc/argocd-server -n argocd 8080:443

Now, open a browser and navigate to https://localhost:8080. Use the username admin and the initial password can be retrieved using:

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
How to Deploy ArgoCD on Kubernetes

After logging in, you should reset your password for security reasons. You can also connect your Git repository and start defining your application. Using ArgoCD on Kubernetes, you can deploy applications directly from your Git repository. Define your application in a YAML file and push it to your repository. Then, use the ArgoCD dashboard or CLI to sync and deploy the application.

Best Practices

Regularly Update ArgoCD: Like all software tools, ensure that you regularly update ArgoCD to leverage new features and security patches.

Use RBAC: Ensure you’re using Kubernetes’ Role-Based Access Control (RBAC) to restrict who can access ArgoCD and what actions they can perform.

Secure Your Secrets: If your applications need secrets, use tools like Sealed Secrets or Kubernetes native secrets. Never hard-code them in your repository.

Troubleshooting Common Issues

  • Sync Failures: If ArgoCD fails to sync an application, check the logs. Often, it’s a discrepancy between the desired state in Git and the live state in the cluster.
  • Connectivity Issues: Ensure your Kubernetes cluster has the right network permissions to pull from your Git repository.

Final Thoughts

Continuous deployment is made easy with ArgoCD when used with the lightweight K3s Kubernetes distribution and the power of Helm. Your deployments will always be in sync with your version-controlled repository if you adhere to GitOps principles.

Therefore, give ArgoCD a try if you want to simplify your deployment processes. It is a top choice for contemporary DevOps teams due to its strength, extensibility, and Kubernetes nativeness.


0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.