DEV Community

Ruan Bekker
Ruan Bekker

Posted on

ArgoCD Getting Started - Hands On

In this tutorial I will show you how to get started with ArgoCD on Kubernetes and we will cover the following topics:

  • How to provision a local Kubernetes cluster.

  • How to deploy ArgoCD on Kubernetes using Helm.

  • How to grant ArgoCD access to you Private Github Repositories.

  • How to configure your application sets on Github, and how to deploy applications to your cluster.

  • How to get started with RBAC to create a local user.

  • How to setup SSO with Authentik.

  • How to use Argo CD Notifications using Email.

Pre-Requisites

To follow along in this tutorial you will need the following

Install a Kubernetes Cluster

If you already have a Kubernetes Cluster, you can skip this step.

Define the kind-config.yaml

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  image: kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
    listenAddress: "0.0.0.0"
  - containerPort: 443
    hostPort: 443
    protocol: TCP
Enter fullscreen mode Exit fullscreen mode

Then create the cluster with kind:

kind create cluster --name example --config kind-config.yaml
Enter fullscreen mode Exit fullscreen mode

ArgoCD Installation

You can deploy Argo CD using the kubernetes manifests and deploy them with kubectl or you can deploy them with helm.

I will be deploying Argo CD using Helm, the reason for that is, I would eventually like to manage my argo deployment using Argo CD, and I have found when deploying it initially using manifests, it was not as smooth as compared to helm.

So to start deploying Argo CD with Helm, so first we will need to add the helm chart repository where the chart is hosted:

helm repo add argo https://argoproj.github.io/argo-helm
Enter fullscreen mode Exit fullscreen mode

Then we can find the latest version using the following:

helm search repo argo/argo-cd
# NAME          CHART VERSION   APP VERSION DESCRIPTION
# argo/argo-cd  6.0.13          v2.10.0     A Helm chart for Argo CD
Enter fullscreen mode Exit fullscreen mode

Now since we have the version, we can get the default values and redirect the output to a file:

helm show values argo/argo-cd --version 6.0.13 > values.yaml
Enter fullscreen mode Exit fullscreen mode

I only have one config parameter that I want to change and the rest I want to keep at defaults, so I am only defining this as my values.yaml:

---
configs:
  params:
    server.insecure: true
Enter fullscreen mode Exit fullscreen mode

Now we can deploy argo cd to our cluster:

helm upgrade --install argocd argo/argo-cd \
  --version 6.0.13 \
  --values values.yaml \
  --namespace argocd --create-namespace
Enter fullscreen mode Exit fullscreen mode

We can monitor our installation and ensure that all the pods are running in the argocd namespace:

kubectl get pods -n argocd
Enter fullscreen mode Exit fullscreen mode

Once the pods are running, we can retrieve the argo cd admin password from a kubernetes secret:

kubectl get secret argocd-initial-admin-secret -n argocd \
  -o jsonpath="{.data.password}" | base64 -d
Enter fullscreen mode Exit fullscreen mode

Now that we have the secret we can create a port-forward session so that we can access the argo cd frontend:

kubectl -n argocd port-forward svc/argocd-server 8080:80
Enter fullscreen mode Exit fullscreen mode

Access the UI on http://localhost:8080

argocd-tuturial

Once we login we should see this:

argocd-tuturial

You will see a blank canvas, we do see an option to create an application via the user interface, but we are not going to use this as we will define all our resources in a declarative manner.

Continue Reading

To access the rest of this post, feel free to see the updated version on my blog:

Top comments (0)