Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

Lab 01: Installing Argo CD

Cluster

Using kind. The port mapping is only needed for the NodePort option below, port-forward doesn’t need it.

cat <<EOF | kind create cluster --name argocd-lab --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 30080
    hostPort: 30080
    protocol: TCP
EOF
kubectl cluster-info --context kind-argocd-lab
  • minikube also works: minikube start --cpus=2 --memory=4096

Install

kubectl create namespace argocd
kubectl apply -n argocd --server-side -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300s
kubectl get deploy,sts,pods,svc -n argocd
  • --server-side is needed, the ApplicationSet CRD is too big for the client-side last-applied annotation
  • stable tracks the latest release, pin a tag (v2.x.y) for anything real
  • Expect deployments for argocd-server, argocd-repo-server, argocd-redis, argocd-dex-server, argocd-applicationset-controller, argocd-notifications-controller
  • argocd-application-controller is a StatefulSet
  • CRDs: applications, applicationsets, appprojects

UI

kubectl port-forward svc/argocd-server -n argocd 8080:443
  • Browse to https://localhost:8080 (self signed cert)
  • User is admin, initial password:
argocd admin initial-password -n argocd
# or
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

Alternative, NodePort:

kubectl patch svc argocd-server -n argocd --type=json -p '[
  {"op":"replace","path":"/spec/type","value":"NodePort"},
  {"op":"add","path":"/spec/ports/1/nodePort","value":30080}]'
  • ports/1 is the https port (443), pinning 30080 matches the kind port mapping so https://localhost:30080 works
  • minikube: minikube service argocd-server -n argocd --url

CLI

brew install argocd
argocd version --client
  • Linux: grab argocd-linux-amd64 from the releases page, sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd

Login (port-forward must be running):

argocd login localhost:8080 --username admin --insecure \
  --password "$(argocd admin initial-password -n argocd | head -1)"
argocd version
argocd cluster list
  • --insecure because of the self signed cert
  • cluster list only shows https://kubernetes.default.svc (in-cluster)
  • Keep CLI and server versions close

Change the password and drop the bootstrap secret:

argocd account update-password
kubectl -n argocd delete secret argocd-initial-admin-secret
  • The initial secret is only for bootstrap, delete it once the password is changed

Cleanup

kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl delete namespace argocd
kind delete cluster --name argocd-lab
  • ctrl-c the port-forward
  • Deleting the manifest removes the CRDs, which deletes any Applications with them