Kubernetes Simulator
advanced · ~10 min
Every server has a name
Each arena server hosts a live match, and a dropped player reconnects to *their* server — so servers need names that stay put. A Deployment's pods get random names that change every time one is replaced.
A StatefulSet gives each pod an ordinal instead — arena-0, arena-1, arena-2 — kept across restarts. It also needs a *headless* Service (clusterIP: None) named in its serviceName, which gives each pod its own DNS name: arena-0.arena.default.svc.cluster.local.
arena.yaml holds the Deployment the team started with. Turn it into a StatefulSet.
Objectives
- A headless Service arena selecting app=arena
- A StatefulSet arena, governed by that Service, with 3 ready servers
- Bonus: Delete arena-1 and watch it come back under the same name
Best on a computer with a keyboard. It works on a phone, with shortcuts under the terminal.