Deploy KubeStellar on K3D#
This document shows how to deploy kubestellar on K3D hub and wec clusters.
This is a point-in-time statement that worked with KubeStellar release v0.22.0.
Prereqs#
In addition to pre-reqs, install k3d v5.6.0 (only k3d version tested so far)
Common Setup for standard examples#
-
You may want to
set -ein your shell so that any failures in the setup or usage scenarios are not lost. -
If you previously installed KS on K3D:
If previously running KS on Kind, clean that up with the Kind cleanup script (ink3d cluster delete kubeflex k3d cluster delete cluster1 k3d cluster delete cluster2 kubectl config delete-context kubeflex || true kubectl config delete-context cluster1 || true kubectl config delete-context cluster2 || truetest/e2e/common/cleanup.sh). -
Set environment variables to hold KubeStellar and OCM-status-addon desired versions:
-
Create a K3D hosting cluster with nginx ingress controller:
-
When we use kind, the name of the container is kubeflex-control-plane and that is what we use in the internal URL for
Wait 1-2 minutes for all pods to be restarted. Use the following command to confirm all are fully running:--force-internal-endpoint-lookup. Here the name of the container created by K3D isk3d-kubeflex-server-0so we rename it: -
Install kubestellar controller and OCM space: We are using nginx ingress with tls passthru. The current install for kubeflex installs also nginx ingress but specifically for kind. To specify passthru for K3D, edit the ingress placement controller with the following command and add
Then initialize kubeflex and create the its1 space with OCM running in it:--enable-ssl-passthroughto the list of args for the containerkflex init kubectl apply -f https://raw.githubusercontent.com/kubestellar/kubestellar/v${KUBESTELLAR_VERSION}/config/postcreate-hooks/kubestellar.yaml kubectl apply -f https://raw.githubusercontent.com/kubestellar/kubestellar/v${KUBESTELLAR_VERSION}/config/postcreate-hooks/ocm.yaml kubectl config rename-context k3d-kubeflex kind-kubeflex kflex create its1 --type vcluster -p ocm -
Install OCM status addon First wait until managedclusteraddons resource shows up on its1 using:
shell kubectl --context its1 api-resources | grep managedclusteraddonsthen install status addon: -
Create a Workload Description Space
wds1in KubeFlex. -
Deploy the OCM based transport controller.
-
Create the Workload Execution Cluster
cluster1and register it Make surecluster1shares the same docker network as thekubeflexhosting cluster.Registerk3d cluster create -p "31080:80@loadbalancer" --network k3d-kubeflex cluster1 kubectl config rename-context k3d-cluster1 cluster1cluster1: Wait for csr to be created: and then accept pending cluster1 cluster Confirm cluster1 is accepted and label it for the BindingPolicy: -
In the same way, make another WEC named "cluster2".
Registerk3d cluster create -p "31180:80@loadbalancer" --network k3d-kubeflex cluster2 kubectl config rename-context k3d-cluster2 cluster2cluster2: Wait for csr to be created: and then accept pending cluster2 cluster Confirm cluster2 is accepted and label it for the BindingPolicy: -
(optional) Check relevant deployments and statefulsets running in the hosting cluster. Expect to see the
The output should look something like the following:kubestellar-controller-managerin thewds1-systemnamespace and the statefulsetvclusterin theits1-systemnamespace, both fully ready.NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE kube-system deployment.apps/coredns 1/1 1 1 10m kube-system deployment.apps/local-path-provisioner 1/1 1 1 10m kube-system deployment.apps/metrics-server 1/1 1 1 10m ingress-nginx deployment.apps/ingress-nginx-controller 1/1 1 1 9m50s kubeflex-system deployment.apps/kubeflex-controller-manager 1/1 1 1 5m45s wds1-system deployment.apps/kube-apiserver 1/1 1 1 3m54s wds1-system deployment.apps/kube-controller-manager 1/1 1 1 3m54s wds1-system deployment.apps/kubestellar-controller-manager 1/1 1 1 3m29s wds1-system deployment.apps/transport-controller 1/1 1 1 2m52s NAMESPACE NAME READY AGE kubeflex-system statefulset.apps/postgres-postgresql 1/1 6m12s its1-system statefulset.apps/vcluster 1/1 5m17s
You may now proceed with Sceario 1 and others in the examples (do not do the "Common Setup", that is written for kind rather than k3d).