Short video:
https://github.com/grs/skupper-kcp-cockroachdb-demo/raw/main/kcp-skupper-cockroachdb-demo.mp4
Non-transparent multi-cluster with skupper and kcp
-
Configure clusters to run workloads on. These must be able to connect to the KCP server. At least one must have a working loadbalancer configuration.
The example commands below assume two clusters named cluster-1 and cluster-2, with kubeconfigs named cluster-1.kubeconfig and cluster-2.kubeconfig respectively.
-
Start KCP server (the following example assume a kubeconfig for KCP named .kcp/admin.kubeconfig).
kcp start
- Create workspace in KCP.
KUBECONFIG=.kcp/admin.kubeconfig kubectl workspaces create skupper-demo --enter
Then create two namespace within that:
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f namespaces.yaml
-
Install site-controller-v2 on each of the physical clusters, along with the required CRDs.
E.g.
kubectl --kubeconfig cluster-1.kubeconfig apply -f skupper-crds.yaml
kubectl --kubeconfig cluster-1.kubeconfig apply -f skupper-site-controller.yaml
and
kubectl --kubeconfig cluster-2.kubeconfig apply -f skupper-crds.yaml
kubectl --kubeconfig cluster-2.kubeconfig apply -f skupper-site-controller.yaml
- Set up syncers for each cluster to the workspace.
KUBECONFIG=.kcp/admin.kubeconfig kubectl kcp workload sync cluster-1 --syncer-image ghcr.io/kcp-dev/kcp/syncer:release-0.7 --resources=services,statefulset.apps,sites.skupper.io,requiredservices.skupper.io,providedservices.skupper.io,servicegroups.skupper.io -o - | kubectl --kubeconfig ./cluster-1.kubeconfig apply -f -
and
KUBECONFIG=.kcp/admin.kubeconfig kubectl kcp workload sync cluster-2 --syncer-image ghcr.io/kcp-dev/kcp/syncer:release-0.7 --resources=services,statefulset.apps,sites.skupper.io,requiredservices.skupper.io,providedservices.skupper.io,servicegroups.skupper.io -o - | kubectl --kubeconfig ./cluster-2.kubeconfig apply -f -
-
Set up locations and placements in the workspace.
a. label the synctarget CRs, e.g.
kubectl --kubeconfig ./.kcp/admin.kubeconfig label synctarget/cluster-1 category=one
kubectl --kubeconfig ./.kcp/admin.kubeconfig label synctarget/cluster-2 category=two
b. create new locations and placements, e.g.
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f locations.yaml
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f placements.yaml
c. delete the default location and placement, e.g.
kubectl --kubeconfig ./.kcp/admin.kubeconfig delete location default
kubectl --kubeconfig ./.kcp/admin.kubeconfig delete placement default
-
Install network-controller in KCP workspace.
E.g.
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f skupper-network-controller.yaml
- Deploy cockroachdb in KCP across namespaces that are labelled for particular locations.
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f one.yaml -n one
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f two.yaml -n two
- Deploy todo app to both locations:
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f todo.yaml -n one
kubectl --kubeconfig ./.kcp/admin.kubeconfig apply -f todo.yaml -n two