In order to register a Kubernetes clusters with the kcp server, users have to install a special component named syncer.
- kcp server
- kcp kubectl plugin
- kubernetes cluster
- Create a workspace and immediately enter it:
$ kubectl kcp workspace create my-workspace --enter
Workspace "my-workspace" (type "Universal") created. Waiting for being ready.
Current workspace is "root:default:my-workspace".
- Enable the syncer for a new cluster
$ kubectl kcp workload sync <mycluster> --syncer-image <image name> > syncer.yaml
- Create a kind cluster to back the workload cluster
$ kind create cluster
Creating cluster "kind" ...
<snip>
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
Alternately, create a kind
cluster with a local registry to simplify syncer development by executing the
following script:
Install ko
:
go install github.com/google/ko@latest
Build image and push to the local registry integrated with kind
:
KO_DOCKER_REPO=localhost:5001 ko publish ./cmd/syncer -t <your tag>
By default ko
will build for amd64
. To build for arm64
(e.g. apple silicon), specify
--platform=linux/arm64
.
To use the image pushed to the local registry, supply --image=<image tag>
to the
enable-syncer
plugin command, where <image tag>
is from the output of ko publish
.
- Apply the manifest to the p-cluster
$ kubectl apply -f syncer.yaml
namespace/kcpsync25e6e3ce5be10b16411448aec95b6b6d695a1daa5120732019531d8d created
serviceaccount/kcp-syncer created
clusterrole.rbac.authorization.k8s.io/kcpsync25e6e3ce5be10b16411448aec95b6b6d695a1daa5120732019531d8d created
clusterrolebinding.rbac.authorization.k8s.io/kcpsync25e6e3ce5be10b16411448aec95b6b6d695a1daa5120732019531d8d created
secret/kcp-syncer-config created
deployment.apps/kcp-syncer created
and it will create a kcp-syncer
deployment:
$ kubectl -n kcpsync25e6e3ce5be10b16411448aec95b6b6d695a1daa5120732019531d8d get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
kcp-syncer 1/1 1 1 13m
- Wait for the kcp workload cluster to go ready.
TODO(marun)