Skip to content

Instantly share code, notes, and snippets.

@henryeleonu
Created December 19, 2022 08:23
Show Gist options
  • Select an option

  • Save henryeleonu/235c91bfd299767a369650b58103b44f to your computer and use it in GitHub Desktop.

Select an option

Save henryeleonu/235c91bfd299767a369650b58103b44f to your computer and use it in GitHub Desktop.
PersistentVolume and PersistentVolumeClaim
kind: PersistentVolume # Create a PV
apiVersion: v1
metadata:
name: postgres-pv-volume # Sets PV's name
labels:
type: local # Sets PV's type to local
app: postgres
spec:
storageClassName: manual
capacity:
storage: 1Gi # Sets PV Volume
accessModes:
- ReadWriteMany
hostPath:
path: "/mtd/data" # Sets the volume's path
---
kind: PersistentVolumeClaim # Create PVC
apiVersion: v1
metadata:
name: postgres-pv-claim # Sets name of PV
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteMany # Sets read and write access
resources:
requests:
storage: 1Gi # Sets volume size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment