Kubernetes MOC
Hub for running Kubernetes on bare metal: how nodes, runtimes and networks fit together, storage and its traps, and the runbooks I use to build and maintain my homelab cluster (Debian, kubeadm: one of three planned control planes behind a virtual IP, plus a dedicated GPU worker).
Core concepts
Architecture
- A Pod Is the Unit Kubernetes Schedules, and Each Pod Gets an IP from the Pod CIDR: control plane vs workers, pods, Services, and choosing a pod CIDR that doesn't overlap the LAN.
- kubelet Depends on containerd Through the CRI Socket: the CRI socket,
SystemdCgroup, no config hot-reload, and the runtime-crash spiral. - containerd Looks for CNI Plugins in One Directory, So a Path Mismatch Blocks Pod Networking: CNI plugins as executables, Debian's
/usr/lib/cnivs/opt/cni/bin,bin_dirover a symlink that misses later plugins (cilium-cni). - A Highly Available Control Plane Needs a Virtual IP That No Single Node Owns:
--control-plane-endpoint, kube-vip leader election, the 1.29 bootstrap deadlock, stale ARP entries. - Workloads on the Only Control Plane Can Starve etcd, So Heavy Nodes Should Be Workers: etcd's latency needs, a tainted GPU worker, when stacked control planes are fine.
- Two etcd Members Tolerate No More Failures Than One, So Go from One Control Plane to Three: Raft quorum, why even counts don't help, joining control planes in one session, snapshots.
- Debian's containerd Package Ships a Config Stub Without SystemdCgroup: the 9-line stub, conditional generation that skips it, checking with
config dump. - containerd Merges Drop-in Files Through imports, So config dump Shows the Real Config:
imports,conf.d/99-nvidia.toml, a main file that saysruncwhilenvidiais the default, a drop-in that undoes laterbin_dirand pause-image fixes.
Networking
- Overlay Networks Encapsulate Pod Traffic Inside Node-to-Node Packets: underlay vs overlay, VXLAN encapsulation, MTU and UDP 8472.
- MetalLB Layer 2 Mode Fails Over a Service IP, It Does Not Spread Traffic: gratuitous ARP, leader election,
strictARPfor IPVS, ServiceLB, kube-vip and Cilium. - Pods Inherit the Node's DNS Resolvers, Including Any ISP Blocklist: CoreDNS forwarding, DNS sinkholing, persistent resolver fixes.
- Layer 4 Load Balancers Route Connections, Layer 7 Load Balancers Route Requests: MetalLB gives the ingress controller one IP, the ingress routes by host name.
- Multicast Discovery Stops at the Pod Overlay, So DLNA Servers Need hostNetwork: SSDP multicast,
hostNetwork: trueand its costs, device profiles. - Pods Should Call Each Other by Service Name, Not Through the Ingress: Service DNS names inside the cluster,
portvstargetPort, ingress names only for browsers.
Storage
- A PersistentVolumeClaim Requests Storage and a StorageClass Provisions It: PV, PVC, StorageClass, local vs network storage, Longhorn.
- Kubernetes Storage Failures Usually Start on the Host or the NAS: NFS client, root squash, UID ownership,
claimRef, node-bound local volumes. - Files Written to an Unmounted Container Path Live Only in That Container's Layer: the download-path trap in a media stack, same paths for cooperating apps.
- SQLite Needs Reliable File Locks, So Its Database Belongs on Local Disk, Not on NFS: SQLite's file locks on NFS,
database is locked, app state on local disk and media on NFS. - A Hardlink Can't Cross Mounts, So Downloads and Media Libraries Must Share One Mount: hardlinks and instant moves need one mount, so a media stack mounts a single
/datashare at the same path everywhere.
Node lifecycle & recovery
- ext4 Remounts Root Read-Only When It Cannot Trust the Disk, and the kubelet Falls with It: the journal,
errors=remount-ro, the containerd and kubelet cascade, worn-out SSDs. - With No Active Root Entry in fstab, systemd Leaves the Root Filesystem Read-Only on Every Boot: the look-alike with clean
fsckand SMART;systemd-remount-fs. - After a Power Cut, Nodes Must Boot After the Storage They Mount: network, storage, control plane, workers; Restore on AC Power Loss.
- A Crash-Looping Pod Can't Be Exec'd Into, So Repair Its Volume from a One-Off Job: scale to zero, mount the claim in a Job, patch the file, scale back.
- kubeadm Uses the Hostname as the Node Name, So Name a Node Before It Joins: node identity in the kubelet certificate, renaming by rejoining, role-based vs neutral names.
- pkgs.k8s.io Has One Repository per Minor Version, So the Repository URL Is the Version Pin: per-minor repositories, holds, choosing a supported minor, version skew.
- An etcd Snapshot Alone Can't Rebuild a kubeadm Control Plane, So Back Up the PKI with It: what a snapshot holds and what it doesn't (CA, ServiceAccount keys), revision bump on restore, restore drills.
- An etcd Snapshot Rolls the Whole Cluster Back, So Restore Only When Re-Applying Can't Fix It: what a snapshot is, how
etcdutl snapshot restoreworks, when to restore and when to re-apply, RPO and RTO. - A Certificate Authority Is the Key Everyone Trusts, So a New One Invalidates Every Certificate It Signed: keys, X.509, mutual TLS between components, why a new CA breaks kubeconfigs, kubelets and pod tokens, renew vs replace.
- A Backup Bundle Packs Everything One Restore Needs into a Single File: snapshot + PKI + manifests in one
.tar.zst, atomicmv, UTC names, 3-2-1 copies. - Runtime Kernel Changes Last Until Reboot Unless Written to Their Configuration Directory:
modprobevsmodules-load.d,sysctl -wvssysctl.d,swapoffvs fstab, Debian 13 ignoring/etc/sysctl.conf, maskingswap.target, checking after a reboot.
Scheduling
- A Toleration Lets a Pod onto a Tainted Node, It Doesn't Send It There: taint effects, toleration vs nodeSelector vs resource requests, placing a stack by role label.
GPUs
- Kubernetes Schedules a GPU Only After a Device Plugin Advertises It as an Extended Resource: driver, NVIDIA runtime in containerd, device plugin;
nvidia.com/gpulimits. - Time-Slicing Lets Pods Share a GPU but Not Isolate Its Memory: one card advertised as several
nvidia.com/gpu; no memory isolation; size by VRAM. - containerd 1.7 Gives Containers a Billion-File Limit, So Code Sized by It Can Exhaust a Node's RAM:
LimitNOFILE=infinity,nvidia-smiandnvidia-persistencedmapping 54 GB, OOM thrash that looks like a hang, the drop-in fix. - A Container's Memory Limit Counts the Files It Writes, So Low Program Memory Doesn't Mean Headroom: page cache charged to the cgroup, dirty pages on NFS that can't be reclaimed in time,
CONSTRAINT_MEMCG,memory.oom.groupkilling the whole container.
Automation
- Post-Deploy Automation Must Treat Already Configured as Success: configuring apps inside pods through their APIs, idempotently.
Workloads & delivery
- A Rolling Restart Starts New Pods Before Stopping Old Ones, So Readiness Decides Whether Users Notice:
rollout restartas a template change,maxSurge/maxUnavailable, readiness probes,Recreatefor RWO and SQLite apps. - Helm Renders a Chart's Templates with Your Values Before Applying Them: charts, values precedence,
helm template,upgrade --install, values lost without--reuse-values. - GitOps Agents Pull the Desired State from Git and Revert Changes Made Outside It: pull-based reconciliation, Argo CD and Flux, self-heal, data and secrets outside Git.
- Argo CD Can Adopt a Running Helm Release When It Renders the Same Chart, Values and Release Name: same chart, version, values and release name; reading the adoption diff; certificates generated on every render (
ignoreDifferences+RespectIgnoreDifferences); no morehelm upgrade. - In an App of Apps, Only the Root Is Applied by Hand, So Its Sync Policy Decides What a Commit Can Delete: one hand-applied root, no prune, no finalizers, manual sync for the CNI,
--cascade=false, bootstrap order.
Runbooks (05 - SOPs & Manuals/)
- Prepare a Debian Node for Kubernetes: swap, kernel modules, containerd, pinned packages, as one script.
- Bootstrap a kubeadm Control Plane and Join Workers:
kubeadm initbehind a kube-vip address without kube-proxy, Cilium, join tokens, taints and labels, more control planes later. - Back Up and Restore etcd on a kubeadm Cluster: scheduled snapshots with the PKI, NAS automount, restore drill, full restore.
- Drain and Shut Down a Bare-Metal Kubernetes Node: drain, stop kubelet and containerd, halt, uncordon.
- Recover a Read-Only Root Filesystem with fsck: bringing a locked node back to read-write.
- kubectl Cheat Sheet: everyday commands, labels, the kubelet service.
- Provide NFS Storage to Kubernetes: Debian or TrueNAS export,
nfs-commonon every node, static PV or nfs-subdir provisioner,subPath. - Enable NVIDIA GPUs on a Bare-Metal Kubernetes Node: DKMS driver, NVIDIA Container Toolkit, device plugin, GPU requests.
- Recover a Bare-Metal Kubernetes Cluster After a Power Outage: boot order, stale ARP for the VIP, provisioner restart,
NotReadynodes, orphaned volumes, stale locks. - Deploy a Media Automation Stack on Kubernetes: Jellyfin and the Arr apps, SSD config and NFS media, in-cluster names, the download path.
Post-mortems (06 - Posts/)
- A Time-Boxed Security Exception: Kubernetes apt Signatures on Debian 13: the Kubernetes repository rejected by Debian 13's verifier, and the exception's closure (Nov 2026).
- The Chicken-and-Egg Deadlock: Bootstrapping Kubernetes 1.29+ with kube-vip: kube-vip and the bootstrap RBAC deadlock.
- The Read-Only Lockdown: Recovering a Bare-Metal Node from a Kernel Panic: a node locked read-only after a kernel panic.
- When Kubelet Dies Silently: Diagnosing Container Runtime Failures:
NodeStatusUnknowncaused by the runtime. - The Playbook That Said ok: A Silent containerd Misconfiguration on Debian 13: a green run that never set the cgroup driver.
- The Regex That Commented Out My Root Filesystem: six months of read-only boots blamed on a disk.
Related maps
- Networking MOC: the network concepts these notes build on.
- Linux Administration MOC: the Debian hosts underneath the cluster.
- Docker and Container Security MOC: containers outside Kubernetes.
References
- Kubernetes documentation - concepts, tasks and reference.