liveBook · Manning

Volume claim template

As explained in Road to Kubernetes

A volume claim template is a StatefulSet specification that defines claims for creating persistent storage resources for its Pods.

A volume claim template is a StatefulSet specification that requests persistent storage for each Pod replica. Unlike a regular Deployment, a StatefulSet can give every Pod its own volume, allowing stateful containers such as databases and message queues to retain data. section 8.4 section 8.4.2

PostgreSQL StatefulSet

A PostgreSQL StatefulSet can declare a volumeClaimTemplates entry named db-vol, request 20Gi of retained block storage, and mount that claim at /var/lib/postgresql. An init container removes the volume's lost+found directory before PostgreSQL starts.

How Road to Kubernetes covers it

How deep it goes
Explains per-replica behavior and shows storage class, access mode, capacity, and mounting, but defers clustered database creation.
Examples
Uses a PostgreSQL StatefulSet with a 20Gi claim, retained block storage, and a db-vol mount.
What it assumes
Assumes familiarity with Pods and Deployments while defining volume claims as requests for managed storage.
What you can do after
Build it from scratch: configure a StatefulSet to request and mount persistent storage for each Pod replica.
How it connects
Connects volume claim templates to StatefulSets, Pods, persistent volumes, storage volumes, and stateful containers.

Also explained in

Compare how 3 books explain volume claim template →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.