Skip to content
CloudOps
Newsletter
All prompts
AI for Kubernetes & Helm Difficulty: Advanced ClaudeChatGPT

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.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week