Kubernetes PersistentVolume Generator

Generates a PersistentVolume (PV) manifest from a form: capacity, one or more access modes, a reclaim policy, and either a hostPath or NFS storage source, ready to paste into kubectl apply. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

Writing a PersistentVolume manifest by hand means remembering the exact nesting for capacity, access modes, and whichever storage backend you're pointing at, and it's easy to typo a quantity suffix or forget the reclaim policy entirely.

This tool builds a PersistentVolume manifest from a form: pick a capacity, one or more access modes, a reclaim policy, and a hostPath or NFS source, and get back valid YAML you can apply directly.

What Is Kubernetes PersistentVolume Generator?

A form-based generator for the `v1/PersistentVolume` resource, the cluster-scoped object that represents a real, provisioned piece of storage in Kubernetes.

It supports the two source types you're most likely to hand-write: `hostPath` (a directory on a specific node, useful for local/dev clusters) and `nfs` (a network filesystem export reachable from any node), plus the common capacity, accessModes, and persistentVolumeReclaimPolicy fields every PV needs regardless of source.

How Kubernetes PersistentVolume Generator Works

Your inputs map directly onto the PV spec: `capacity.storage` gets your entered quantity (validated against Kubernetes' quantity suffixes like Gi/Mi/Ti), `accessModes` becomes a list of the modes you toggled on, and `persistentVolumeReclaimPolicy` is set to whichever policy you selected.

Depending on the source type toggle, the tool emits either a `hostPath.path` block or an `nfs.server`/`nfs.path` block, and nothing else, so the output only contains fields relevant to your chosen backend.

When To Use Kubernetes PersistentVolume Generator

Use it when standing up a local or lab cluster (kind, minikube, k3s) and you need a quick hostPath-backed PV to bind a PVC against, without digging through the docs for the exact YAML shape.

It's also useful for NFS-backed clusters where storage is provisioned manually rather than through a CSI driver and dynamic provisioning.

Features

Advantages

  • Validates capacity as a real Kubernetes quantity (e.g. '10Gi') before generating anything, catching a common source of `kubectl apply` rejections.
  • Only emits the source-specific fields for whichever backend (hostPath or NFS) you actually selected, keeping the output minimal and readable.
  • Covers all three access modes and all three reclaim policies in one form, so you don't need to memorize their exact spelling.

Limitations

  • Doesn't generate CSI-based PVs (cloud block/file storage via a driver), since those fields are driver-specific rather than a small common set.
  • Doesn't create the matching PersistentVolumeClaim, use the PersistentVolumeClaim Generator alongside this one to bind against the PV.

Examples

A 10Gi hostPath PV for local development

Input

name: local-data-pv, capacity: 10Gi, accessModes: [ReadWriteOnce], reclaimPolicy: Retain, sourceType: hostPath, hostPath: /mnt/data

Output

apiVersion: v1
kind: PersistentVolume
metadata:
  name: local-data-pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: /mnt/data

A minimal hostPath PV, suitable for binding a single-node PVC in a local dev cluster.

Best Practices & Notes

Best Practices

  • Default to 'Retain' for anything with real data, and only use 'Delete' once you're confident the underlying storage backend's delete behavior is what you expect.
  • Set a `storageClassName` when you want explicit, non-dynamic binding to a specific PVC rather than relying on the default storage class.
  • Prefer NFS (or a real CSI driver) over hostPath for anything that needs to survive a Pod being rescheduled to a different node.

Developer Notes

The generator treats `capacity`, `accessModes`, and `persistentVolumeReclaimPolicy` as always-present fields and only branches on the source type for the `hostPath` vs `nfs` block, matching how the upstream API schema itself is structured (source types are mutually exclusive oneOf-style fields under `spec`). Quantity validation is a regex against the common binary suffixes (Ki/Mi/Gi/Ti/Pi/Ei); it does not attempt to validate decimal SI suffixes or exponent notation, which are rarer in hand-written manifests.

Kubernetes PersistentVolume Generator Use Cases

  • Provisioning a hostPath-backed PV for a local kind/minikube cluster
  • Wiring up an NFS export as cluster storage for a lab or on-prem environment
  • Quickly producing a PV to pair with a hand-written PersistentVolumeClaim during a tutorial or demo

Common Mistakes

  • Forgetting that hostPath only works if the consuming Pod lands on the same node the path exists on.
  • Setting reclaimPolicy to 'Delete' on a PV backed by data you actually want to keep.
  • Mismatching accessModes between the PV and the PVC that's supposed to bind to it, which prevents binding entirely.

Tips

  • Feed the generated PV's name and storageClassName into the PersistentVolumeClaim Generator to make sure the two manifests are compatible.

References

Frequently Asked Questions