December 2017
Intermediate to advanced
404 pages
9h 28m
English
Often, you will need a place to store files and data in a persistent way. Since individual Pods are fairly short-lived in a Kubernetes environment, it is usually not a good solution to store files directly in a container's filesystem. In Kubernetes, this issue is solved using persistent volumes, which are basically a more flexible abstraction of the Docker volumes that you have already worked with before.
To create a new persistent volume, create a new example-volume.yaml file with the following contents:
apiVersion: v1
kind: PersistentVolume
metadata:
name: volume01
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
- ReadWriteMany
hostPath:
path: /data/volume01
Create the volume using kubectl apply -f example-volume.yaml ...
Read now
Unlock full access