Name, stage and shrink a StatefulSet

  • 14 min
  • 6 steps
  • Config, storage and state

Steps

0 of 6 done

Give the kv StatefulSet the headless Service its pod DNS names need, follow a claim across a pod replacement, stage an upgrade with a partition, and make scale-down delete claims.

  1. Step 1 of 6

    All three kv pods in data are running, yet client cannot resolve kv-0.kv.data.svc.cluster.local. Create the object the StatefulSet names but never creates, so that each replica gets its own DNS name.

    Checked against the cluster as it changes.

  2. Step 2, not started: Delete pod kv-1. When the controller replaces it, show the name of the claim the replacement mounts.

  3. Step 3, not started: Stage an upgrade to redis:8.10 as a canary: only kv-2 may run redis:8.10, while kv-0 and kv-1 stay on redis:8.8.

  4. Step 4, not started: The canary is healthy. Let the upgrade reach the remaining replicas.

  5. Step 5, not started: Scaling kv down should delete the claims of the removed replicas, while deleting the StatefulSet itself should keep every claim. Set that policy on kv.

  6. Step 6, not started: Scale kv to one replica and wait until only the claim of the replica that remains is left.

Lab terminal

Cluster time 1 minute 10 seconds
kind cluster kx, Kubernetes 1.37.
Each step is checked as you work.
​
Tab completes. Up and Down recall.
Type help for more.
Terminal keys

Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.