This repository contains experiment materials to setup an Argo CD cluster that can use OCM to place applications to target clusters.
We provide 2 infrastructures to deploy OCM and Argo:
- using kind to run it on your computer
- using GKE clusters
kind is a tool for running local Kubernetes clusters using Docker.
This setup will create a 3 single-node kind clusters:
- hub: contains the OCM hub and Argo CD server
- cluster1 and cluster2: are OCM managed clusters and are used as deploy environments by Argo
The following binaries should be present in our path for setting up this infrastructure:
Then you can run the setup_with_kind.sh
to install the infrastructure.
If you need some proxies to access internet you should export your proxy settings before running the command:
export http_proxy="..."
export https_proxy="..."
export no_proxy="127.0.0.1,172.17.0.1(,...)"
./setup_with_kind.sh
GKE is a Google Cloud managed Kubernetes engine. You need a Google Cloud account to use this installation method.
In addition, the following binaries should be present in our path for setting up this infrastructure:
- gcloud
- gcloud gke-gcloud-auth-plugin:
gcloud components install gke-gcloud-auth-plugin
- kubectl
- clusteradm
- argocd
Then you can run the setup_with_gke.sh
to install the infrastructure.
If you need some proxies to access internet you should export your proxy settings before running the command:
export http_proxy="..."
export https_proxy="..."
./setup_with_gke.sh
Now we will first deploy a placement policy that in our case will request to deploy the application on both cluster1 and cluster2. And then we will deploy the actual application using an ApplicationSet (a kind of application template).
You can follow the deployment in the Argo UI.
CONTEXT_HUB="$(kubectl config get-contexts -o name | grep hub)"
# Deploy a placement policy
kubectl -n argocd --context "${CONTEXT_HUB}" apply --wait -f ./manifests/placement.yaml
# Deploy the app
kubectl -n argocd --context "${CONTEXT_HUB}" apply --wait -f ./manifests/argocd_application_set.yaml
Simply run the following command to delete kind clusters:
kind delete clusters hub cluster1 cluster2
Simply run the following command to delete GKE clusters:
gcloud container clusters delete ocm-hub ocm-mcluster1 ocm-mcluster2 --region=europe-west1-b