CephLXXXVI · Kubernetes RBDKubernetes RBD
Aligning Kubernetes and Ceph topology
What you'll learn
- Align Kubernetes and Ceph topology labels
- Verify the alignment is correct
- Recognise the failures caused by misalignment
- Maintain alignment as the infrastructure changes
Prerequisites
None — start here.
Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18
Why this matters in production
Two systems each describe where things are, and neither validates the other. Misalignment produces placement decisions that look correct and are not.
The two descriptions
Kubernetes: node labels
topology.kubernetes.io/zone=zone-a
topology.kubernetes.io/region=eu-west
Ceph: the CRUSH hierarchy
root default
rack zone-a
host ceph-01
kubectl get nodes -L topology.kubernetes.io/zone
ceph osd tree
Neither system knows about the other’s description, so agreement is maintained by convention and verification.
Aligning them
# 1. establish the physical truth
# which host is in which rack, verified against the rack
# 2. label Kubernetes nodes to match
kubectl label node k8s-01 topology.kubernetes.io/zone=zone-a
# 3. place Ceph hosts to match
ceph osd crush move ceph-01 rack=zone-a
# 4. verify both against the physical layout
The physical layout is the authority; both descriptions must match it rather than each other.
Verifying
# Kubernetes view
kubectl get nodes -o custom-columns=\
'NODE:.metadata.name,ZONE:.metadata.labels.topology\.kubernetes\.io/zone'
# Ceph view
ceph osd tree | awk '/rack/ {r=$NF} /host/ {print $NF, r}'
# and against the physical reality — the part nothing automates
The third check is the one that fails: a host moved between racks updates neither description automatically.
Failures from misalignment
| Misalignment | Failure |
|---|---|
| Ceph host in the wrong CRUSH rack | replicas placed in one physical rack |
| Kubernetes node labelled wrongly | pods scheduled away from their data |
| Zone names differing between systems | topology constraints match nothing |
| A rack added to one description only | placement decisions ignore it |
| Both correct but not matching physical | both systems confidently wrong |
The last is the dangerous one: both descriptions are internally consistent and both are wrong about reality, so every check passes and the protection does not exist.
Maintaining alignment
# a check worth scheduling
#!/bin/bash
echo "== Kubernetes"
kubectl get nodes -o json | python3 -c '
import sys,json
for n in json.load(sys.stdin)["items"]:
print(n["metadata"]["name"],
n["metadata"]["labels"].get("topology.kubernetes.io/zone","NONE"))'
echo "== Ceph"
ceph osd tree | awk '/rack/ {r=$NF} /host/ {print $NF, r}'
| Event | Requires |
|---|---|
| A host physically moved | update both descriptions |
| A new node added | label it and place it in CRUSH |
| A rack added | add to both descriptions |
| A host decommissioned | remove from both |
Quiz
Knowledge check · 4 questions
Q1. Two Ceph hosts are recorded in different CRUSH racks but are physically in the same rack. What happens?
Q2. The Kubernetes node labels and the CRUSH hierarchy can agree perfectly with each other and both still be wrong.
Q3. Verify topology alignment after a datacentre move.
Several hosts were physically relocated between racks during a datacentre reorganisation. Both Kubernetes and Ceph report healthy.
Q4. What is the authority for topology, and why does that matter?
Passing score: 75%. Answers are checked in this browser.
Production discipline
Verify both topology descriptions against the physical layout rather than against each other — two internally consistent descriptions can both be wrong, and every health check passes while the protection does not exist. Add the alignment check to any procedure that moves hardware.
Cross-course references
- Kubernetes: node labels describing zones are equally unverified against reality
- Linux: any redundancy scheme depends on the topology description being true