CertGrid CertGrid
Hands-on Lab·Kubernetes and Cloud Native Associate

Controllers and Pod Recreation

Deployment Pods are interchangeable and named at random; StatefulSet Pods have stable identities and each keeps its own disk across deletion and rescheduling. That single difference is why databases use one and web front ends use the other. Both run in one namespace here, get the same Pod deleted, and are compared on the same screen.

Kubernetes Fundamentals Guide 10 of 46 Beginner

Written against the versions above. `volumeClaimTemplates` creates one PVC per replica, named `<template>-<statefulset>-<ordinal>`. Those PVCs are deliberately NOT deleted with the StatefulSet. `persistentVolumeClaimRetentionPolicy` can change that, and is left at its default here so the default behaviour is what you see.

Both workloads are scheduled across the three workers. The StatefulSet's Pods keep their identity wherever they land, which is easiest to see when there is more than one node they could land on.
Server NameIP AddressOSRolesCPURAMHDD
CKA1001192.168.0.175Ubuntu 26.04 LTSControl Plane Node2 Core4 GB50 GB
CKA1001-NODE01192.168.0.176Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE02192.168.0.177Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE03192.168.0.178Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB

Before you start

  1. Named in order, with a disk each

  2. Write something only db-0 has

  3. Delete it, and the same Pod comes back

  4. The same test on a Deployment

  5. What deleting the StatefulSet leaves behind

Official sources