The following Demo must be run within the federation-v2 repository/Gopath.
Newer versions of minikube and certain drivers (kvm2) do not run with the "-p --profile" flag. Minikube v.25.2 has been used with kvm and virtualbox to successfully run this demo.
minikube start -p us-west
minikube start -p us-east
kubectl config use-context us-west
kubectl config set-context us-west --namespace=test-namespace
kubectl config set-context us-east --namespace=test-namespace
kubectl create ns federation
crinit aggregated init mycr --host-cluster-context=us-west
kubectl config delete-context mycr
kubectl config delete-cluster mycr
apiserver-boot run in-cluster --name federation --namespace federation --image <registry/username/imagename:tag>
kubectl config get-clusters
go build -o bin/kubefnord cmd/kubefnord/kubefnord.go
./bin/kubefnord join us-west --host-cluster-context us-west --add-to-registry --v=2
./bin/kubefnord join us-east --host-cluster-context us-west --add-to-registry --v=2
kubectl -n federation describe federatedclusters
git clone https://github.com/font/k8s-example-apps.git
cd k8s-example-apps/sample-fed-v2-demo/configs
kubectl create -f .
for i in us-west us-east; do echo; echo ------------ ${i} ------------; echo; kubectl --context ${i} get ns test-namespace; echo; echo; done
for i in us-west us-east; do echo; echo ------------ ${i} ------------; echo; kubectl --context ${i} get configmaps; echo; echo; done
for i in us-west us-east; do echo; echo ------------ ${i} ------------; echo; kubectl --context ${i} get secrets; echo; echo; done
for i in us-west us-east; do echo; echo ------------ ${i} ------------; echo; kubectl --context ${i} get rs; echo; echo; done
Remove us-east
via a patch command or manually:
kubectl -n test-namespace patch federatednamespaceplacement test-namespace -p \
'{"spec":{"clusternames": ["us-west"]}}'
kubectl -n test-namespace edit federatednamespaceplacement test-namespace
Then verify replicasets
:
for i in us-west us-east; do echo; echo ------------ ${i} ------------; echo; kubectl --context ${i} -n test-namespace get rs; echo; echo; done
Update FederatedNamespacePlacement
to add back us-east
again via a patch command or manually:
kubectl -n test-namespace patch federatednamespaceplacement test-namespace -p \
'{"spec":{"clusternames": ["us-west", "us-east"]}}'
kubectl -n test-namespace edit federatednamespaceplacement test-namespace
Then verify replicasets:
for i in us-west us-east; do echo; echo ------------ ${i} ------------; echo; kubectl --context ${i} -n test-namespace get rs; echo; echo; done
So you can see that Federation-v2 handles workloads by joining clusters into the workload, allowing you to specify the resource types that you want to propagate, override certain parameters that you want to differentiate in your clusters, and specify the placement rules for where you want that resource type to be propagated.
minikube delete -p us-east
minikube delete -p us-west