depths-oq31yn had a three-replica database. The StatefulSet db was deleted. Three more storage faults sit next to it. Fix them in any order.
kubectl get sts,pods,pvc -n depths-oq31yn
kubectl get pvsts db gone
pvc data-db-0..2 Bound (data intact)
pv archive-pv Released (claim deleted, Retain)
pvc cache Pending (market-api cannot start)
sts cache template redis:7.4, Pods still redis:7.2Bring the database back
The original manifest is at ~/depths-oq31yn/db.yaml. Read it first:
cat ~/depths-oq31yn/db.yamlA StatefulSet with the same name and the same volumeClaimTemplates names the same claims: data-db-0, data-db-1, data-db-2. They exist and are Bound, so the controller does not create new ones and the Pods mount the old volumes.
kubectl apply -f ~/depths-oq31yn/db.yaml
kubectl get sts,pods,pvc -n depths-oq31ynReclaim the archive volume
archive-pv is Released. A claim archive-restore is waiting for it. Clear the stale reference:
kubectl patch pv archive-pv -p '{"spec":{"claimRef":null}}'
kubectl get pv archive-pvFix the cache claim
market-api is Pending because its claim cache is Pending:
kubectl describe pvc cache -n depths-oq31ynThe class name in ~/depths-oq31yn/api.yaml is misspelled. A claim's class cannot be changed in place: fix the file, delete the claim, apply the file. The Deployment's Pod is the first consumer, so the claim binds and the Pod starts.
Finish the cache update
The cache StatefulSet's template says redis:7.4; its Pods still run redis:7.2:
kubectl get sts cache -n depths-oq31yn -o jsonpath='{.spec.updateStrategy}'
kubectl get pods -n depths-oq31yn -l app=cache -o jsonpath='{.items[*].spec.containers[0].image}'The partition equals the replica count, so no ordinal is updated. Lower it to 0 and the update runs from cache-1 down to cache-0:
kubectl patch sts cache -n depths-oq31yn -p '{"spec":{"updateStrategy":{"rollingUpdate":{"partition":0}}}}'
kubectl rollout status sts cache -n depths-oq31ynThe last objective is a question: after a StatefulSet scales down, which object still holds the removed Pod's data?