Skip to content

Anthos-inspired experiment using Argo CD for multi-cluster config management

Notifications You must be signed in to change notification settings

mikesparr/multi-cluster-argo-demo

Repository files navigation

Argo CD Multi-Cluster Demo

Inspired by Google Anthos Configuration Manager (ACM) I wondered if I could use Argo CD and a repository to auto-configure multiple Kubernetes clusters. This repo is my sandbox for testing this theory and playing with different features.

Architecture

The objective is to connect multiple kubernetes clusters via Argo CD to this repo and whenever I push changes in this repo, they will automatically apply the changes.

Architecture

Usage

  1. Create or use an existing Google Cloud Platform project (demo purposes but any clusters should work)
  2. Clone this repository to your computer, cd to multi-cluster-argo-demo
  3. Create a .env file in the same directory as create-k8s-clusters.sh
cat > .env << EOF
export PROJECT_ID=<YOUR PROJECT ID>
export AUTH_NETWORK="<YOUR IP ADDRESS>/32"
EOF
  1. Execute the bootstrap script ./create-k8s-clusters.sh
  2. Log into your clusters after 8-10 minutes and confirm you have east and west clusters and Argo CD workloads are installed. Clusters created Argo CD installed
  3. Port forward requests to Argo CD server and fetch default password (server pod name)
# port forward (for now) to access argocd UI
kubectl port-forward svc/argocd-server -n argocd 8080:443 &

# fetch initial password (auto generated)
export ARGO_PASS=$(kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2)
echo "Argo default pass: ${ARGO_PASS}"
  1. Open browser to http://localhost:8080 (accept security warning) and use admin and <PASSWORD FROM ABOVE> to confirm applications synced Apps synced in Argo UI
  2. Confirm your clusters have the namespace, serviceaccount, role, rolebinding declared in the k8s-config/ folder Confirmed new namespace exists
  3. Create your own repo and change the app-of-apps.yaml and k8s-config.yaml to point to your repo instead.
  4. Enjoy!

Cleanup

If you are just trying this out, then to avoid unnecessary expense either delete your project or remove the recently-created clusters using the commands below:

gcloud container clusters delete west --zone us-west2-b
gcloud container clusters delete east --zone us-east1-c

Video Demo

If you want to see this demo in action, view the YouTube video below ArgoCD Kubernetes Multi-Cluster Config Demo

Potential next steps

  • read about private repositories
  • use Argo CD projects
  • use recursive directories
  • add application workloads as well as cluster config

References

About

Anthos-inspired experiment using Argo CD for multi-cluster config management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages