1. apiVersion: v1
    2. kind: PersistentVolume
    3. metadata:
    4. name: longhorn-vol-pv
    5. spec:
    6. capacity:
    7. storage: 2Gi
    8. volumeMode: Filesystem
    9. accessModes:
    10. - ReadWriteOnce
    11. persistentVolumeReclaimPolicy: Delete
    12. storageClassName: longhorn
    13. csi:
    14. driver: driver.longhorn.io
    15. fsType: ext4
    16. volumeAttributes:
    17. numberOfReplicas: '3'
    18. staleReplicaTimeout: '2880'
    19. volumeHandle: existing-longhorn-volume
    20. ---
    21. apiVersion: v1
    22. kind: PersistentVolumeClaim
    23. metadata:
    24. name: longhorn-vol-pvc
    25. spec:
    26. accessModes:
    27. - ReadWriteOnce
    28. resources:
    29. requests:
    30. storage: 2Gi
    31. volumeName: longhorn-vol-pv
    32. storageClassName: longhorn
    33. ---
    34. apiVersion: v1
    35. kind: Pod
    36. metadata:
    37. name: volume-pv-test
    38. namespace: default
    39. spec:
    40. restartPolicy: Always
    41. containers:
    42. - name: volume-pv-test
    43. image: nginx:stable-alpine
    44. imagePullPolicy: IfNotPresent
    45. livenessProbe:
    46. exec:
    47. command:
    48. - ls
    49. - /data/lost+found
    50. initialDelaySeconds: 5
    51. periodSeconds: 5
    52. volumeMounts:
    53. - name: vol
    54. mountPath: /data
    55. ports:
    56. - containerPort: 80
    57. volumes:
    58. - name: vol
    59. persistentVolumeClaim:
    60. claimName: longhorn-vol-pvc