liveBook · Manning

Volume claim template

As explained in Kubernetes for Developers

A volume claim template is a StatefulSet specification template from which Kubernetes creates a PersistentVolumeClaim for each Pod.

A volume claim template is a StatefulSet specification that tells Kubernetes to create a separate PersistentVolumeClaim for each Pod. It replaces a single shared claim, so replicated stateful Pods can each receive their own disk. section 9.2

Using a volume claim template gives StatefulSet storage behavior that a Deployment with one standalone claim cannot provide:

  • Creates one PersistentVolumeClaim from the template for every StatefulSet Pod. section 9.2
  • Associates each claim with a stable Pod identity, such as mariadb-0. section 9.2 section 9.2.1
  • Keeps the claim definition inside volumeClaimTemplates, removing the need to create a separate PersistentVolumeClaim object. section 9.2.1

MariaDB StatefulSet

A MariaDB StatefulSet mounts the template-produced claim at /var/lib/mysql. With one replica, Kubernetes creates a claim named mariadb-pvc-mariadb-0; adding replicas produces distinct claims rather than mounting the same claim on every Pod. section 9.2.1

How Kubernetes for Developers covers it

How deep it goes
Defines the template, generated claim naming, and manifest placement, but does not detail claim fields or storage provisioning.
Examples
Uses MariaDB and Redis StatefulSets with claims mounted for database and data storage.
What it assumes
Assumes familiarity with Pods, Deployments, Pod specifications, volume mounts, and PersistentVolumeClaims.
What you can do after
Build StatefulSets that create and mount a distinct PersistentVolumeClaim for each Pod without separate claim objects.
How it connects
Connects StatefulSet, PersistentVolumeClaim, Pod identity, Deployment, and PersistentVolume access modes.

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 Kubernetes for Developers. The section links point to the parts of the book it draws on.