liveBook · Manning

Retain policy

As explained in Kubernetes in Action, Second Edition

The Retain policy preserves a PersistentVolume and its underlying storage after the associated claim is deleted or released.

A Retain policy preserves a PersistentVolume and its underlying storage after the associated PersistentVolumeClaim is deleted or released. It is typical for statically provisioned volumes, unlike dynamically provisioned volumes that commonly use Delete. section 10.3.3

A retained volume follows this lifecycle:

  • Deleting the claim changes the PersistentVolume from Bound to Released rather than Available. section 10.3.3
  • A new claim does not automatically bind to the Released volume because its existing data may require review or removal. section 10.3.3
  • Making the volume reusable requires deleting and recreating the PersistentVolume object; the object points to storage rather than containing its data. section 10.3.3
$ kubectl get pv local-disk-on-my-node
NAME                    RECLAIM POLICY   STATUS     CLAIM
local-disk-on-my-node   Retain           Released   default/quiz-data-local

Inspect the reclaim policy, Released status, and former claim association with kubectl. section 10.3.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains status transitions and reuse requirements, but stops short of detailed cleanup or recreation commands.
Examples
Uses the local-disk-on-my-node volume and quiz-data-local claim to show Released status and failed automatic rebinding.
What it assumes
Assumes familiarity with PersistentVolumes, PersistentVolumeClaims, pods, and basic kubectl inspection.
What you can do after
Operate retained volumes by recognizing Released status and understanding why a new claim remains Pending.
How it connects
Connects PersistentVolumes with PersistentVolumeClaims, static provisioning, dynamic provisioning, and reclaim policies.

Related concepts

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