Three machines, built from the worker up.
Hover or focus a part to see what it does and which lesson installs it. Trust shows the certificate each component uses. Traffic shows who connects to whom, and on which port. Build marks each part with its lesson. Move the slider to see the cluster after any lesson.
You can turn on more than one. Scroll the diagram sideways to see all three machines.
control-plane
- etcd:2379
- kube-apiserver:6443
- kube-schedulerBindings
- kube-controller-manager10.244.0.0/16
- CoreDNS172.16.0.2:53
worker-1
- containerd + runck8s.io
- kubelet:10250
- flanneldflannel.1
- kube-proxyiptables
worker-2
- containerd + runck8s.io
- kubelet:10250
- flanneldflannel.1
- kube-proxyiptables
13 lessons in four parts.
Two lessons of setup, then the worker node, the control plane, and finally the cluster that joins them. Nothing is installed by a script. Each lesson downloads a release binary, writes its config and systemd unit by hand, and checks the result.
What each lesson installs, and how you know it works.
Each block lists what the lesson installs, the setting that matters most, what fails before the lesson, and the command the lesson uses to check the result. Red text is the error you get before the fix.
Every lesson has the same four steps.
Download the component, configure it by hand, run it as a systemd service, and watch what it does. Each lesson opens a playground that already has everything from the earlier lessons, so you never rebuild from scratch.
The control plane runs as systemd services instead of Pods inside Kubernetes. That keeps each component separate from the cluster it builds, which makes it easier to see what each one does.
The course is for learning, not for production. Some steps use simplified or insecure settings on purpose, and the course points to kubeadm, kops or a managed service for real clusters.
- Kubernetes
v1.34.0- containerd
2.2.1, runcv1.4.0- CNI plugins
v1.9.0- etcd
v3.6.4- Flannel
v0.27.2, CNI pluginv1.7.1-flannel2- CoreDNS
1.12.2
Every component runs as a systemd service.
Config files belong to root, so edit them with sudoedit or sudo. The course provides each unit file; it goes in /etc/systemd/system/. After every change to a unit, reload systemd and start the service again.
When a service does not come up, systemctl status shows its state and journalctl -u shows its logs.
$ sudo systemctl daemon-reload $ sudo systemctl enable --now kubelet
$ sudo journalctl -u kubelet.service
One machine that can run containers.
containerd pulls images and manages containers, but it does not start processes itself. It hands that to an OCI runtime, runc. The lesson installs containerd alone first, and running a container fails until runc is there.
The next failure is the network: nerdctl asks for the bridge CNI plugin and finds nothing in /opt/cni/bin. After the CNI plugins are installed, a podinfo container starts and answers on port 9898.
SystemdCgroup = true makes containerd use systemd's cgroup driver. The kubelet is set to the same driver in the next lesson, so both manage one cgroup tree.
- Installs
- containerd
2.2.1, runcv1.4.0, nerdctl2.2.1, CNI pluginsv1.9.0 - Config
/etc/containerd/config.toml- Plugins
/opt/cni/bin
$ sudo ctr run --rm ghcr.io/sagikazarmark/docker-hello-world:latest hello ctr: failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v2.task/default/hello/log.json: no such file or directory): exec: "runc": executable file not found in $PATH
version = 3 [plugins."io.containerd.cri.v1.runtime".containerd.runtimes.runc.options] SystemdCgroup = true
$ PODINFO_IP=$(sudo nerdctl inspect --format '{{ .NetworkSettings.IPAddress }}' podinfo) $ curl -f "http://${PODINFO_IP}:9898"
The kubelet runs Pods before any control plane exists.
The kubelet reads Pod manifests from /etc/kubernetes/manifests and starts them through containerd. These are static Pods: no API server is involved. Clusters that run their control plane as Pods start it this way.
Its config is split into small files in /var/lib/kubelet/config.d/, merged in order. For now its API on port 10250 accepts anonymous requests and allows everything. Lesson 9 turns off anonymous access.
The containers do not show up in nerdctl ps, because Kubernetes puts them in the k8s.io containerd namespace. crictl talks to containerd through the same interface the kubelet uses, so it sees them.
- Installs
- kubelet
v1.34.0, crictlv1.34.0, kubeletctlv1.13 - API
:10250- Static Pods
/etc/kubernetes/manifests
apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration containerRuntimeEndpoint: unix:///var/run/containerd/containerd.sock cgroupDriver: systemd
$ curl -sfk https://localhost:10250/pods | jq '.items[0].metadata'
etcd holds all cluster state, and only the API server talks to it.
The lesson moves to the control-plane machine. etcd starts over plain HTTP so you can write and read keys with etcdctl and see what it stores. Then it gets TLS and requires a client certificate.
etcd gets its own CA, separate from the Kubernetes one in lesson 6. Only the API server connects to etcd, so this CA signs just two certificates: etcd's server certificate and one client certificate. The course runs a single member and explains why clusters use an odd number of members: a write needs a majority.
- Installs
- etcd, etcdctl, etcdutl
v3.6.4 - Port
:2379for clients- Certificates
/etc/etcd/pki: CA, server, and one client cert shared by etcdctl and the API server
$ cat <<EOF | sudo tee -a /etc/default/etcd
ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:2379
ETCD_CLIENT_CERT_AUTH=true
ETCD_CERT_FILE=/etc/etcd/pki/server.crt
ETCD_KEY_FILE=/etc/etcd/pki/server.key
ETCD_TRUSTED_CA_FILE=/etc/etcd/pki/ca.crt
ETCD_NAME=$(hostname)
ETCD_ADVERTISE_CLIENT_URLS=https://$(hostname):2379
EOF
$ bash --login -c "etcdctl endpoint health"
The API server is a REST API in front of etcd.
A few flags are enough to start it: where etcd is, which certificates to use for it, and the Service range. The lesson creates and patches a namespace with plain curl, then reads the stored object back out of etcd, where it sits under /registry as protobuf.
Requests need credentials first. The lesson starts with a static token file, then creates the Kubernetes CA and switches to client certificates. The admin certificate has O=system:masters, and RBAC reads that field as the user's group.
10.96.0.0/12 is the range Service IPs come from. The first address, 10.96.0.1, goes to the kubernetes Service, so it is in the API server certificate's names.
- Installs
- kube-apiserver and kubectl
v1.34.0, auger1.0.3 - Port
:6443- Authorization
Node,RBAC
$ curl -f -k https://localhost:6443/api/v1/namespaces
--service-cluster-ip-range=10.96.0.0/12 \
--etcd-cafile=/etc/etcd/pki/ca.crt \
--etcd-certfile=/etc/etcd/pki/client.crt \
--etcd-keyfile=/etc/etcd/pki/client.key \
--etcd-servers=https://127.0.0.1:2379 \
--authorization-mode=Node,RBAC \
$ kubectl cluster-info
The scheduler only writes one field.
Before the scheduler runs, a new Pod stays unscheduled: its spec.nodeName is empty. The lesson creates a Node object by hand, since there is no real worker yet, and then assigns the Pod by posting a Binding with curl.
That Binding is all the scheduler does. Once it runs, new Pods get a nodeName. They stay Pending, because no kubelet is attached to that Node.
- Installs
- kube-scheduler
v1.34.0 - Certificate
CN=system:kube-scheduler- Kubeconfig
/etc/kubernetes/scheduler.conf
$ kubectl get pod podinfo-unscheduled -o jsonpath='{.spec.nodeName}'
$ kubectl get pod podinfo-scheduler -o jsonpath='{.spec.nodeName}'
Without controllers, a ReplicaSet creates nothing.
The API server stores a ReplicaSet with three replicas, and nothing happens. Creating Pods from it is the job of a controller. After kube-controller-manager starts, the three Pods appear, and a deleted Pod is replaced.
It also hands each node a slice of the Pod network (--allocate-node-cidrs) and signs certificate requests with the Kubernetes CA. Both matter in lessons 9 and 10.
- Installs
- kube-controller-manager
v1.34.0 - Pod network
10.244.0.0/16, one/24per node- Certificate
CN=system:kube-controller-manager
$ kubectl get pods -l app=podinfo No resources found in default namespace.
$ kubectl get pods -l app=podinfo
The worker asks for its own certificate.
The worker from lessons 3 and 4 joins the control plane. It only gets the CA certificate and a bootstrap token. The kubelet uses the token once to send a certificate signing request. RBAC approves it automatically, the controller manager signs it, and the kubelet uses the signed certificate from then on.
The node registers but stays NotReady: the container runtime has no network config. A loopback-only CNI config is enough to make it Ready. Pod networking comes in the next lesson.
- Token
abcdef.0123456789abcdef, a Secret of typebootstrap.kubernetes.io/token- Kubelet flags
--bootstrap-kubeconfig,--kubeconfig- API server flags
--enable-bootstrap-token-auth=true, plus a client cert for calling kubelets
$ kubectl describe node worker container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
$ sudo kubectl config set-credentials default \
--kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--token=abcdef.0123456789abcdef
$ kubectl wait --for=condition=Ready node worker $ kubectl get nodes
Pods on two machines can reach each other.
From here the cluster has two workers, worker-1 and worker-2. A bridge CNI config gives each node's Pods addresses from that node's /24, and Pods on the same node can talk. A Pod on worker-1 cannot reach a Pod on worker-2: neither machine knows where the other's Pod range is.
The lesson adds the two routes by hand to show that routing is the only missing piece, then removes them and installs Flannel. flanneld runs on each worker, reads the node's Pod range from the API server, and carries traffic between nodes over VXLAN.
- Installs
- flanneld
v0.27.2, flannel CNI pluginv1.7.1-flannel2 - Pod ranges
- worker-1
10.244.0.0/24, worker-210.244.1.0/24 - Backend
- VXLAN, interface
flannel.1
$ PODINFO_IP=$(kubectl get pod podinfo-worker-2 -o jsonpath='{.status.podIP}') $ kubectl exec client-worker-1 -- curl -fsS --max-time 5 "http://${PODINFO_IP}:9898/version"
{
"Network": "10.244.0.0/16",
"EnableNFTables": false,
"Backend": {
"Type": "vxlan"
}
}
$ PODINFO_IP=$(kubectl get pod podinfo-worker-2 -o jsonpath='{.status.podIP}') $ kubectl exec client-worker-1 -- curl -fsS "http://${PODINFO_IP}:9898/version"
A Service IP works once kube-proxy writes iptables rules.
A Service for three podinfo Pods gets a ClusterIP, and its EndpointSlice lists the Pods. A request to the ClusterIP still times out, because no machine has that address. It only exists as a rule.
kube-proxy runs on each worker and writes those rules. In iptables mode, each Service gets an entry in the KUBE-SERVICES chain that rewrites the destination to one of its Pods, picked at random.
- Installs
- kube-proxy
v1.34.0 - Mode
- iptables
- Config
/etc/kubernetes/kube-proxy/config.yaml,clusterCIDR: 10.244.0.0/16
$ CLUSTER_IP=$(kubectl get svc podinfo -o jsonpath='{.spec.clusterIP}') $ kubectl exec deploy/podinfo -- curl -fsS --max-time 5 "http://${CLUSTER_IP}:80"
$ sudo iptables -t nat -L KUBE-SERVICES -n | grep podinfo
$ CLUSTER_IP=$(kubectl get svc podinfo -o jsonpath='{.spec.clusterIP}') $ kubectl exec deploy/podinfo -- curl -fsS "http://${CLUSTER_IP}:80"
Service names resolve.
The lesson first sets the kubelet's clusterDNS to 172.16.0.2, so every new Pod gets it as its nameserver. Nothing answers there yet, so curl http://podinfo fails.
CoreDNS runs as a systemd service on the control-plane machine and listens on its address, 172.16.0.2, port 53. kubeadm would put it behind a Service at 10.96.0.10; here Pods use the host address directly. CoreDNS watches Services through the API server and answers for cluster.local.
- Installs
- CoreDNS
1.12.2 - Listens on
172.16.0.2:53, the control-plane'seth0- Kubelet setting
clusterDNS: [172.16.0.2],clusterDomain: cluster.local
$ kubectl exec client -- cat /etc/resolv.conf search default.svc.cluster.local svc.cluster.local cluster.local nameserver 172.16.0.2 options ndots:5
$ kubectl exec client -- curl -fsS --max-time 5 "http://podinfo:80"
What the course leaves out, and what to try next.
The finished cluster has one control-plane machine, two workers, Flannel, kube-proxy and CoreDNS, all running as systemd services.
It skips a highly available control plane, backups, tighter security and monitoring. The course suggests building the cluster again from memory, comparing it with what kubeadm generates, and replacing Flannel and kube-proxy with Cilium.
Its last exercise: stop one component at a time and predict the symptom before you read the logs.
Open lesson 13 on iximiuz LabsHow it differs from Kubernetes The Hard Way
The course says it was inspired by Kelsey Hightower's Kubernetes The Hard Way. Both build a cluster without kubeadm or an installer. They differ in order, in how nodes get their certificates, and in how much of the cluster they cover.
10.244.0.0/16. Static routes are tried first, then removedKubernetes The Hard Waybridge CNI and four static routes on 10.200.0.0/16What runs where
Every binary the course downloads, grouped by the machine it runs on. The daemons among them run as systemd services; the rest are command-line tools.