Kubernetes persistentVolume and hostPath
Jump to navigation
Jump to search
Internal
Example
kind: PersistentVolume
apiVersion: v1
metadata:
name: local-1
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
storageClassName: manual
hostPath:
path: /tmp/local-1
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: local-1
spec:
accessModes:
- ReadWriteOnce
storageClassName: manual
volumeName: local-1
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
name: 'example'
spec:
containers:
- name: 'example'
image: docker.io/ovidiufeodorov/httpd:latest
volumeMounts:
- name: 'example-volume'
mountPath: '/example'
volumes:
- name: 'example-volume'
persistentVolumeClaim:
claimName: local-1