advanced · ~12 min
Not on spot
Ticket from Priya Raman, senior backend developer
search was evicted twice this week. Both times hackademy-worker was reclaimed — it's a spot node, and search's nodeSelector asks for disk: ssd, which only that node has.
search must never run on a spot node. It's faster on ssd, so it should still prefer ssd wherever that's allowed. Losing it hurts more than a slow disk. search.yaml is the manifest.
Node affinity
nodeSelector with more words. required… terms filter nodes with operators In, NotIn, Exists and DoesNotExist, so it can say "never on spot". preferred… terms add a weight (1–100) to nodes that match, so the scheduler favours them without insisting. Docs
Objectives
- search: 2 ready replicas, none on a spot node
- search's template rules out spot nodes
- …and still prefers ssd
- Bonus: Read the nodes' labels before changing anything
Best on a computer with a keyboard. It works on a phone, with shortcuts under the terminal.