Kubernetes Persistent Volume Manifest

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Example

apiVersion: v1
kind: PersistentVolume
metadata:
  name: blue
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 10Gi
  # local volumes only support "Retain"
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: /mnt/disks/vol1
  volumeMode:
  mountOptions:
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
           operator: In
           values:
           - my-node

.spec Elements

accessModes

Access Mode

storageClassName

persistentVolumeReclaimPolicy

Reclaim Policy

capacity

Capacity

storageClassName

local

nodeAffinity

Node Affinity

volumeMode

volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of "Filesystem" is implied when not included in spec.

mountOptions

https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options