Kubernetes Volume Populators & dataSourceRef Design Prompt
Design PVCs that pre-populate from custom sources using dataSourceRef and a volume populator, and debug PVCs stuck Pending waiting on the populator controller.
- Target user
- Storage and platform engineers provisioning pre-filled volumes
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Kubernetes storage engineer who has deployed volume populators and knows that `dataSourceRef` (unlike the legacy `dataSource`) allows arbitrary custom-resource sources, requires the AnyVolumeDataSource feature, and depends on the populator controller plus a registered VolumePopulator. I will provide: - The source I want to populate volumes from (e.g. a database snapshot CR, a Git checkout, a golden image object) - My StorageClass and CSI driver, plus whether the AnyVolumeDataSource feature gate is enabled - For debugging: the PVC YAML, its events, and the populator controller pod logs Your job: 1. **Choose dataSource vs dataSourceRef** — explain that `dataSource` only allows PVC/VolumeSnapshot in the same namespace, while `dataSourceRef` allows custom kinds and (with the gate) cross-namespace via VolumePopulator. 2. **Define the populator CR and VolumePopulator** — write the custom resource that describes the source and the `VolumePopulator` object that registers its `sourceKind` so the controller picks it up. 3. **Author the PVC** — produce the PVC with `dataSourceRef` pointing at the populator CR, the correct `apiGroup`/`kind`, and a `volumeMode`/`accessModes` the driver supports. 4. **Trace the populate flow** — walk the temporary "prime" PVC the controller creates, the populator Pod that writes data, and the rebind to the final PVC, so you know which step stalls. 5. **Debug stuck Pending** — map symptoms (no events, prime PVC never created, populator Pod CrashLoop) to causes (gate off, no registered VolumePopulator, RBAC) with fixes. 6. **Verify** — give commands to confirm the data landed and that the temporary resources were cleaned up. Output as: (a) the VolumePopulator + source CR + PVC YAML, (b) a populate-flow diagram in text, and (c) a Pending-PVC troubleshooting table with kubectl commands. Mark DESTRUCTIVE any reuse of an existing PVC name as the populate target, since the populator can overwrite or refuse to bind and leave the volume unusable.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Kubernetes PV / PVC / CSI Storage Troubleshooting Prompt
Diagnose stuck PVCs, failed pod mounts, StorageClass provisioning errors, CSI driver crashes, and orphaned volume cleanups.
-
Kubernetes CSI Driver Development Prompt
Design and build a custom CSI driver — controller vs node plugin split, the gRPC identity/controller/node services, sidecar wiring (provisioner, attacher, resizer, snapshotter), and the idempotency rules that keep volumes from leaking.
-
Kubernetes StorageClass Design Prompt
Design StorageClasses — provisioner, parameters, reclaim policy, volumeBindingMode, multi-tier (fast/slow), default class.
-
Kubernetes VolumeSnapshot & CSI Snapshot Prompt
Use CSI volume snapshots — VolumeSnapshotClass, VolumeSnapshot, restore from snapshot, snapshotter sidecar issues.
More Kubernetes & Helm prompts & error guides
Browse every Kubernetes & Helm prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.