ArgoCD Getting Started - Hands On
Tags: argocd, devops, kubernetes, tutorial
Published: 2024-05-05 07:28:24

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

* [Kind](https://ruanbekker.hashnode.dev/create-kubernetes-clusters-with-kind) installed (if you are provisioning Kubernetes with it)
    
* [Helm](https://helm.sh/docs/intro/install/)
    
* [Kubectl](https://kubernetes.io/docs/tasks/tools/)
    

## Install a Kubernetes Cluster

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

Define the `kind-config.yaml`

```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
```

Then create the cluster with `kind`:

```bash
kind create cluster --name example --config kind-config.yaml
```

## 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:

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

Then we can find the latest version using the following:

```bash
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
```

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

```bash
helm show values argo/argo-cd --version 6.0.13 > values.yaml
```

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`:

```yaml
---
configs:
  params:
    server.insecure: true
```

Now we can deploy argo cd to our cluster:

```bash
helm upgrade --install argocd argo/argo-cd \
  --version 6.0.13 \
  --values values.yaml \
  --namespace argocd --create-namespace
```

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

```bash
kubectl get pods -n argocd
```

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

```bash
kubectl get secret argocd-initial-admin-secret -n argocd \
  -o jsonpath="{.data.password}" | base64 -d
```

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

```bash
kubectl -n argocd port-forward svc/argocd-server 8080:80
```

Access the UI on [http://localhost:8080](http://localhost:8080)

![argocd-tuturial](https://cdn.hashnode.com/res/hashnode/image/upload/v1708292240242/1dd1b841-7d35-4677-b4bc-c5091cc69193.png)

Once we login we should see this:

![argocd-tuturial](https://cdn.hashnode.com/res/hashnode/image/upload/v1708292506516/3812b061-6360-402f-aed8-0376939b82bd.png)

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:

- https://ruan.dev/blog/2024/26/03/getting-started-with-argo-cd-on-kubernetes---the-ultimate-guide