A management cluster for control planes
This is the free lesson
Next: Your first tenant control plane
The rest of this course is part of Pro, together with every other course and the ones added later.
$25 a month billed yearly, or $29 month to month
Until 30 November: $210 for the first year, or $14.50 for the first month, with code LAUNCH.
A free account keeps your progress across devices. The paid lessons need Pro.
Code Snippets
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: kamaji-mgmt
nodes:
- role: control-plane
extraPortMappings:
# tenant API servers, published on the Mac only (127.0.0.1)
- containerPort: 31443
hostPort: 31443
listenAddress: 127.0.0.1
- containerPort: 31444
hostPort: 31444
listenAddress: 127.0.0.1docker info --format '{{.NCPU}} CPUs, {{.MemTotal}} bytes of memory'
kind version && kubectl version --client && helm version --short
kind create cluster --config cluster.yaml --image kindest/node:v1.37.0
docker ps --filter label=io.x-k8s.kind.cluster=kamaji-mgmt --format 'table {{.Names}}\t{{.Ports}}'
helm install cert-manager oci://quay.io/jetstack/charts/cert-manager --version v1.21.3 \
--namespace cert-manager --create-namespace --set crds.enabled=true --wait
git -c advice.detachedHead=false clone -q --depth 1 --branch 26.11.4-edge \
https://github.com/clastix/kamaji.git
grep -h "production ready\|subscription basis" kamaji/docs/content/reference/versioning.md
REL=https://api.github.com/repos/clastix/kamaji/releases/tags/26.11.4-edge
curl -s $REL | jq -r .body | grep evaluation
helm repo add clastix https://clastix.github.io/charts
helm dependency build kamaji/charts/kamaji
helm install kamaji kamaji/charts/kamaji --namespace kamaji-system --create-namespace \
--set image.tag=26.11.4-edge --wait --timeout 10m
kubectl get crds -o name | grep kamaji
kubectl get datastores
kubectl get pods -n kamaji-systemIn this video you'll build a management cluster with kind, and install Kamaji, which runs the control planes of other Kubernetes clusters as pods. The management cluster is one kind node, a container in Colima's virtual machine. cert-manager issues the certificate of Kamaji's webhooks. Kamaji runs on top, with a datastore of three etcd members that will hold the state of every tenant cluster. Two node ports, published on localhost, will lead to the API servers, the application programming interfaces, of tenant clusters. In this lesson you will create the management cluster from a kind file, install cert-manager and Kamaji from a pinned release, and find the resource types and the datastore that Kamaji adds. Before you start, you need Docker, which I run with Colima, and kind, kubectl, Helm, git and jq. One Homebrew command installs them. Docker runs in a Colima virtual machine with four CPU cores, central processing units, and about eight gigabytes of memory. The management cluster, and every control plane it hosts, will live in there. kind 0.33, kubectl 1.37 and Helm 4.3. The management cluster comes from a kind configuration file, which I keep in my project folder, kamaji-on-mac. One node, named kamaji-mgmt. It publishes two node ports, three one four four three and three one four four four, on one two seven dot zero dot zero dot one only. Each tenant control plane gets one of them, so kubectl on the Mac reaches its API server, the application programming interface, directly. kind starts one container from the node image of Kubernetes 1.37.0. It takes about half a minute, so I speed up the video. One node container, with both ports on one two seven dot zero dot zero dot one. Kamaji's webhooks need a certificate, which cert-manager issues, so cert-manager comes first: version 1.21.3, from its OCI registry, the Open Container Initiative format, with its custom resource definitions. Helm pulls the chart and waits until cert-manager's three deployments are ready. This takes about a minute, so I speed up the video. Now Kamaji. Clastix, the company behind it, publishes an edge release every month. Its Helm repository only has an old chart and a floating latest one, so I clone the tag I pin, 26.11.4 edge, with depth one: just that commit. A tag is not a branch, so git would print a long note about a detached HEAD. The advice setting keeps it quiet. What does edge mean? Here are Clastix's own words, from the versioning page in the repository. Edge releases "are generally considered production ready". Versioned stable releases are "available on a subscription basis". The release notes of this tag say something else. "This is an edge release and is intended for testing and evaluation purposes only." Testing and evaluation is exactly what this cluster is for. Kamaji itself is open source, under the Apache 2.0 license. The chart is in the clone. It depends on another chart, kamaji-etcd, the datastore, from the Clastix chart repository. helm dependency build needs that repository added first. Then I install it with the image tag of the same release, and wait until everything is ready. Kamaji starts its controller and a three-member etcd cluster, which will keep the state of the tenant clusters. This takes a minute or two, so I speed up the video. Dario Tranchitella, the chief technology officer of Clastix, summed it up in his udienza.com episode: "Kamaji runs Kubernetes control planes in pods of a management cluster instead of on virtual machines: cheaper, more secure, quicker." Kamaji adds three resource types. A DataStore is where tenant clusters keep their state. A TenantControlPlane describes a whole control plane in one object. A KubeconfigGenerator writes kubeconfig files for the tenant control planes it selects. One DataStore, named default, with the etcd driver, and ready. Behind it, three etcd pods, next to the Kamaji controller. The management cluster is ready to host control planes. In this lesson you learned to build a management cluster from a kind file, to install Kamaji from the git tag of an edge release, and the three resource types it adds, with a datastore that is ready for tenants.