- Working Kubernetes cluster
- Working
kubectl
config
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s1.private.swifthomelab.net Ready control-plane 3m54s v1.28.6
k8s2.private.swifthomelab.net Ready control-plane 3m36s v1.28.6
k8s3.private.swifthomelab.net Ready control-plane 3m3s v1.28.6
(ArgoCD-cli installation not necessary)
- Bootstrap ArgoCD and wait for it to come up
kubectl create namespace argocd
kubectl apply -n argocd -k bootstrap/install && kubectl -n argocd rollout status deployment argocd-server
- Install base applications (argo-cd, root, cluster-resources)
kubectl apply -f bootstrap/
Base application definition
argo-cd
manages argo-cd installtion itself, reconciles ownership of resources after initial installation with step 1.root
manages applications in 'app-of-apps' pattern ondefault
projectcluster-resources
owns global cluster resources that should be preserved on application deletion (like theargocd
namespace)
-
Update ArgoCD user password
- Generate password hash using bcrypt (Python implementation)
python3 -I
>>> import bcrypt >>> print(bcrypt.hashpw(b'YOUR-PASSWORD-HERE', bcrypt.gensalt()).decode()) >>> exit()
- Create ArgoCD admin secret with new hash
kubectl apply -f ./secrets/argocd.yaml
# ./secrets/argocd.yaml apiVersion: v1 stringData: admin.password: YOUR-PASSWORD-HASH kind: Secret metadata: labels: app.kubernetes.io/name: argocd-secret app.kubernetes.io/part-of: argocd name: argocd-secret namespace: argocd type: Opaque
- Update password mtime
kubectl -n argocd patch secret argocd-secret \ -p '{"stringData": {"admin.passwordMtime": "'$(date +%FT%T%Z)'"}}'
You could also install the ArgoCD CLI and update passwords via
argocd account update-password
-
Forward ArgoCD server on loopback port 8443/HTTPS
kubectl port-forward svc/argocd-server -n argocd 8443:443
-
Sign-in to ArgoCD via web UI using new password
-
Manually sync all applications
- Restart admin server to apply HTTPs patch
kubectl -n argocd rollout restart deployment argocd-server && kubectl -n argocd rollout status deployment argocd-server
- ArgoCD is now available at ingress (done)
Note: https://kubernetes.default.svc
is the default address for the local cluster that ArgoCD is installed in. If ArgoCD should manage an external cluster, this address must be changed.
This repository follows the app of apps pattern described here. Manual pinning of cluster version and strict access control is necesarry due to the inherent danger of auto-bootstrapping clusters.
kubectl -n kubernetes-dashboard create token admin
kubectl -n kubernetes-dashboard get secret admin -o jsonpath={".data.token"} | base64 -d
Label nodes
kubectl label node k8s1.private.swifthomelab.net topology.kubernetes.io/region=cluster1
kubectl label node k8s1.private.swifthomelab.net topology.kubernetes.io/zone=pve2
kubectl patch node k8s1.private.swifthomelab.net -p $'spec:\n providerID: proxmox://cluster1/501'
kubectl label node k8s2.private.swifthomelab.net topology.kubernetes.io/region=cluster1
kubectl label node k8s2.private.swifthomelab.net topology.kubernetes.io/zone=pve1
kubectl patch node k8s2.private.swifthomelab.net -p $'spec:\n providerID: proxmox://cluster1/502'
kubectl label node k8s3.private.swifthomelab.net topology.kubernetes.io/region=cluster1
kubectl label node k8s3.private.swifthomelab.net topology.kubernetes.io/zone=pve3
kubectl patch node k8s3.private.swifthomelab.net -p $'spec:\n providerID: proxmox://cluster1/503'
Install secret
# config.yaml
clusters:
- url: https://pve1.private.swifthomelab.net:8006/api2/json
insecure: false
token_id: "kubernetes-csi@pve!csi"
token_secret: "secret-api-token"
region: cluster1
kubectl -n csi-proxmox create secret generic proxmox-csi-plugin --from-file=config.yaml