Installing ArgoCD on k3s

2 min read Tweet this post

ArgoCD is an open-source GitOps continuous delivery tool that automates the deployment of applications to Kubernetes. It offers features such as automated rollbacks, automatic synchronization of the deployed application with the Git repository, and a web-based UI to manage the deployed applications. However, setting up a Kubernetes cluster for testing or development purposes can be challenging, as it requires significant resources, especially in terms of CPU and memory. In this article, we will show how to install ArgoCD using k3s, a lightweight Kubernetes distribution, in a local environment.

k3s is a lightweight, certified Kubernetes distribution that is optimized for production workloads in resource-constrained environments. k3s requires less than 512MB of RAM and can run on a single node or a cluster of nodes. It also includes all the necessary components for running Kubernetes, such as the Kubernetes API server, scheduler, and kubelet. Additionally, k3s is easy to install and manage, making it an ideal choice for testing and development environments.

To install k3s, we need to follow these steps:

  1. Download and install k3s on the local machine:
curl -sfL https://get.k3s.io | sh -

  1. Wait for k3s to be installed and started:
sudo systemctl status k3s

  1. Verify that k3s is running:
sudo k3s kubectl get nodes

If everything is working correctly, we should see the local machine listed as a Kubernetes node.

Once we have k3s installed and running, we can proceed to install ArgoCD. To install ArgoCD on k3s, we need to follow these steps:

  1. Create a namespace for ArgoCD:
sudo k3s kubectl create namespace argocd

  1. Install the ArgoCD Helm chart:
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
helm install argocd argo/argo-cd --namespace argocd

  1. Verify that ArgoCD is running:
sudo k3s kubectl get pods -n argocd

If everything is working correctly, we should see the ArgoCD server and associated pods listed.

  1. Get the ArgoCD server password:
sudo k3s kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

This command will output the password for the initial ArgoCD administrator account.

  1. Open the ArgoCD UI:
sudo k3s kubectl port-forward svc/argocd-server -n argocd 8080:443

This command forwards port 8080 on the local machine to port 443 on the ArgoCD server. We can then access the ArgoCD UI by opening a web browser and navigating to https://localhost:8080. When prompted, enter the username admin and the password we obtained in the previous step.

In this article, we have shown how to install ArgoCD on a local machine using k3s, a lightweight Kubernetes distribution. k3s offers a simplified installation process and requires less CPU and memory compared to a full-fledged Kubernetes cluster. This makes it an ideal choice for testing and development environments where resources are limited. With ArgoCD and k3s, we can automate the deployment of applications to Kubernetes in a simple and efficient way.

devops