advanced · ~15 min
One basket
Ticket from Dana Kowalski, on-call lead
Last night hackademy-worker rebooted and the orders API was down for four minutes. It has two replicas — both were on that node.
Make sure two api replicas can never share a node again, without taking the API down while you do it. api.yaml is its manifest.
Pod anti-affinity
A rule about other pods: don't schedule me where a pod matching this label selector already runs. topologyKey sets what "where" means: kubernetes.io/hostname is one node. required… is a hard filter, preferred… only a score. The scheduler checks it at placement time; running pods are never moved. Docs
maxSurge and maxUnavailable
A rolling update's two bounds. maxSurge is how many extra pods may exist during the update (default 25%, rounded up); maxUnavailable is how many may be missing (default 25%, rounded down). With 2 replicas the defaults mean: add a new pod first, never drop below 2. Docs
Objectives
- api's pods refuse to share a node with another api pod
- api: 2 ready replicas, one on each worker
- Bonus: Never fewer than one ready api pod
Best on a computer with a keyboard. It works on a phone, with shortcuts under the terminal.