argocd-applicationset-demo

Purpose

This repository contains slides, Kubernetes manifest files and instructions for my talk Deploy N Applications to N Clusters using Argo CD ApplicationSet. This is not a stand-alone workshop repository. You will need to refer to the talk slides/video to make sense of the exercises provided below. The resource section contains suggested readings/resources on GitOps, Argo CD and ApplicationSet.

Pre-requisites

  • An understanding of Kubernetes, GitOps and Argo CD
  • Access to at least two managed Kubernetes clusters (recent versions preferred). For ease of reference, we'll call the cluster where Argo CD is installed cluster-manager and the other cluster(s) as managed-cluster.
  • kubectl & argocd CLI tools installed (recent versions required)
  • kubectx for easy Kubernetes cluster context switching (optional)

Argo CD and ApplicationSet installation

kubectl create namespace argocd

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/applicationset/v0.2.0/manifests/install.yaml

Accessing the Argo CD API Server

  1. Change the argocd-server service type to LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
  1. Wait a few minutes for the loadbalancer to be available:
kubectl get svc -A | grep argocd-server

Right next to the private IP column, you will see a public IP for the argocd-server service.

  1. From a web browser, navigate to that public IP. Use admin as the username and find the default password from the following command (Argo CD v1.9 and later):
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
  1. Change the default admin password for Argo CD server from the CLI:
argocd login <public IP found in step2>

Use the same credentials from Step3.

Once succesfully logged in, use the following command to update the password:

argocd account update-password --current-password <default admin password> --new-password <set a password of your choice>

🚧 For the following examples, make sure that the namespace already exists on the cluster(s) prior to creating the Application/ApplicationSet custom resource(s).

Argo CD Demo

kubectl create namespace kustomize-nginx-ns

kubectl apply -f files/kustomize-nginx-app.yaml -n argocd

ApplicationSet Demo

List Generator example:

# Change the Kubernetes context first
kubectx <context for the managed-cluster>

# Create the namespace on the managed-cluster
kubectl create namespace guestbook-ns

kubectl apply -f files/list-generator.yaml -n argocd

Git Generator (directory) example:

kubectl apply -f files/git-generator-directory.yaml -n argocd

🚧 guestbook-jsonnet application will take longer to sync and appear healthy.

Matrix Generator (list & git directory) example:

kubectl apply -f files/matrix-generator.yaml -n argocd

FAQ

As I deliver talks, I collect questions from the audience and then crowdsource the answers from the experts and the community. You can find a list of frequently asked questions on Argo CD here and on ApplicationSet here.


Resources