Pv example

From UVOO Tech Wiki
Jump to navigation Jump to search
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-foo
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: manual
  hostPath:
    path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-foo
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: manual
---
apiVersion: v1
kind: Pod
metadata:
  name: foo
spec:
  containers:
    - name: foo-container
      image: nginx
      volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: foo-storage
  volumes:
    - name: foo-storage
      persistentVolumeClaim:
        claimName: pvc-foo