Setup ArgoCD Locally
In many cases you find yourself testing things in local environments, whether it's scripts or workflows, you need a safe space to break things and learn.
ArgoCD is no exception, and while ArgoCD is native to Kubernetes, you don't need to spend money by running clusters in some cloud. I'll be using KinD to create a cluster on my laptop and install everything we need.
Introduction
We will use 2 repos: - Orangutan-infra - Will manage the infrastructure. - Orangutan - Will manage the configuration files.
Installation
Create Kubernetes Cluster
- Create a cluster:
kind create cluster --name playground
You can runkubectl get nodes
to make sure the control-plane is running.
Preparing The Files
We'll use Terraform to install ArgoCD. We'll utilize Terraform's Helm provider to install ArgoCD instead of directly applying the chart on our cluster.
Before installing the Helm chart, you can run helm search repo argocd
to search for the chart:
Note
You can run helm show values argo/argo-cd > argo-default-values.yaml
to export the default values of the chart. It's helpful when you want to see what values exist for each chart before deploying it.
- In
orangutan-infra
I'll create the following folders and files: For our values fileargocd.yaml
, we'll pass the following:--insecure
will serve our UI on HTTP.
0-provider.tf
We'll configure Helm as our provider and pass ~/.kube/config
to use the local cluster we created:
1-argocd.tf
For the Helm installation, we'll use the the following block:
resource "helm_release" "argocd" {
name = "argocd"
repository = "https://argoproj.github.io/argo-helm"
chart = "argo-cd"
namespace = "argocd"
create_namespace = true
values = [file("values/argocd.yaml")]
}
Installing ArgoCD
- Run
terraform init
to initialize Terraform. If it was successful, you should see the following output: -
We're ready to run
terraform apply
. If we did everything correctly, the output will show us the resources that we're deploying. Enteryes
and wait for ArgoCD to finish installing. -
If all went well, you should be able to see our pods are in
Running
state:
Tip
You can run helm status argocd -n argocd
to follow the deployment status:
Accessing ArgoCD
- We need to port forward the Argo Server in order to access it:
- Go to
http://localhost:8080
. You'll need to enter a username and password. By default, the username isadmin
. To get the password, we'll need to first fetch the secret that Argo created in our cluster: The password is base64 encrypted. Let's decrypt it (don't copy the%
char, it just states the end of the string): - Login to Argo's UI and change your password
That's it, you successfully installed ArgoCD locally ✅