liveBook · Manning

Volume mode

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

Block volume mode exposes a persistent volume as an unformatted raw block device rather than a mounted filesystem.

Volume mode determines how a Kubernetes persistent volume is exposed. FileSystem is the default and mounts the volume as a directory; Block exposes an empty, unformatted block device. section 7.1.2

Choose and verify the mode according to the workload requirement:

  • Use FileSystem when the requirement describes a directory or mounted filesystem. section 7.5
  • Use Block when the requirement describes raw storage or an unformatted device. section 7.1.2
  • Add volumeMode: Block to the PV spec; rename the PV if an existing volume already uses the name. section 7.1.2
  • Run kubectl describe pv to confirm VolumeMode after applying the manifest. section 7.1.2

Create and verify a Block-mode PV

Add this field to the PV YAML:\n\nvolumeMode: Block\n\nApply it with kubectl apply -f pv.yaml, then run kubectl describe pv <pv-name>. The output should show VolumeMode: Block, distinguishing it from a FileSystem PV. section 7.1.2

root@kind-control-plane:/# kubectl describe pv vol02833
Name:            vol02833
Labels:          type=local
Annotations:     pv.kubernetes.io/bound-by-controller: yes
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    manual
Status:          Bound
Claim:           default/claim-02833
Reclaim Policy:  Retain
Access Modes:    RWO
VolumeMode:      FileSystem
Capacity:        100Mi
Node Affinity:   <none>
Message:
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /mnt/data
    HostPathType:
Events:            <none>

Use the persistent-volume description output to locate and verify the VolumeMode field alongside access modes, capacity, and claim information. section 7.1.2

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Defines both modes, shows the YAML field and verification command, but does not require creating the underlying block storage.
Examples
Uses PV YAML, kubectl apply, kubectl describe, local disks, EBS, Azure Disk, iSCSI, Fibre Channel, and CephFS.
What it assumes
Assumes familiarity with persistent volumes, YAML manifests, kubectl, and the distinction between directories and raw storage.
What you can do after
Configure a PV as FileSystem or Block and verify the resulting mode with kubectl.
How it connects
Connects volume modes with persistent volumes, persistent volume claims, pods, storage classes, access modes, and reclaim policies.

Also explained in

Compare how 2 books explain volume mode →

Related concepts

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