Kubernetes Persistent Volume Manifest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#persistentvolume-v1-core
=Internal=
=Internal=
* [[Kubernetes_Storage_Concepts#Persistent_Volume_.28PV.29|Kubernetes Storage Concepts]]
* [[Kubernetes_Storage_Concepts#Persistent_Volume_.28PV.29|Kubernetes Storage Concepts]]
=Example=
=Example=


Line 9: Line 11:
   [[Kubernetes_Manifest_Metadata#name|name]]: blue
   [[Kubernetes_Manifest_Metadata#name|name]]: blue
  [[Kubernetes_Manifests#spec|spec]]:
  [[Kubernetes_Manifests#spec|spec]]:
   accessModes:
   [[#accessModes|accessModes]]:
   - RedWriteOnce
   - ReadWriteOnce
  storageClassName: test
   [[#capacity|capacity]]:
   capacity:
     storage: 10Gi
     storage: 10Gi
   persistentVolumeReclaimPolicy: Retain
   <font color=teal># local volumes only support "Retain"</font>
   ...
  [[#persistentVolumeReclaimPolicy|persistentVolumeReclaimPolicy]]: Retain
   [[#storageClassName|storageClassName]]: local-storage
  [[#local|local]]:
    path: /mnt/disks/vol1
  [[#volumeMode|volumeMode]]:
  [[#mountOptions|mountOptions]]:
  [[#nodeAffinity|nodeAffinity]]:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
            operator: In
            values:
            - my-node


=.spec Elements=
=.spec Elements=
==accessMode==
==accessModes==
{{Internal|Kubernetes_Storage_Concepts#Access_Mode|Access Mode}}
==storageClassName==
 
==persistentVolumeReclaimPolicy==
{{Internal|Kubernetes_Storage_Concepts#Reclaim_Policy|Reclaim Policy}}
==capacity==
{{Internal|Kubernetes_Storage_Concepts#Capacity|Capacity}}
 
==storageClassName==
==local==
==nodeAffinity==
{{Internal|Kubernetes_Storage_Concepts#Node_Affinity|Node Affinity}}
==volumeMode==
<code>volumeMode</code> 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==
{{External|https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options}}

Latest revision as of 22:48, 30 March 2021

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