k8wiz
Playground

Fix a PersistentVolumeClaim stuck in Pending

Intermediate · Kubernetes · about 12 min

The db StatefulSet's Pod is Pending and so is its claim. The cluster runs the AWS EBS CSI driver, with a default StorageClass called gp3.

Loading the playground...

About this scenario

The db StatefulSet's Pod is Pending and so is its claim. The cluster runs the AWS EBS CSI driver, with a default StorageClass called gp3.

Fix the claim template. A StatefulSet can't change its volumeClaimTemplates, so you'll recreate it.

Objectives

  1. Find why the claim is Pending
  2. db-0 is Running with a Bound gp3 volume
  3. Check the volume is in the same zone as the node

What you'll practice

  • A claim stays Pending until a PV binds to it. A class that doesn't exist stops provisioning with a ProvisioningFailed event.
  • WaitForFirstConsumer delays the disk until the scheduler has picked a node, so the disk lands in the right zone.
  • volumeClaimTemplates are immutable; deleting a StatefulSet keeps its PVCs, so delete those too when you start over.

How the playground works

The cluster runs entirely in your browser: a simulated API server, scheduler, kubelets and controllers, with virtual nodes in three zones. kubectl output follows the real formats, errors use the real messages, and the add-ons (CSI storage, Traefik, Envoy Gateway, cert-manager, Flux, Argo CD) behave like their real counterparts for the common paths. It's a simulation, so some behavior is simplified. Your progress is saved in this browser.

Read next