April 2018
Intermediate to advanced
468 pages
14h 34m
English
To illustrate all the concepts, let's do a mini-demonstration where we create a HostPath volume, claim it, mount it, and have containers write to it.
Let's start by creating a hostPath volume. Save the following in persistent-volume.yaml:
kind: PersistentVolumeapiVersion: v1metadata: name: persistent-volume-1spec: StorageClassName: dir capacity: storage: 1Gi accessModes: - ReadWriteOnce hostPath: path: "/tmp/data"> kubectl create -f persistent-volume.yamlpersistentvolume "persistent-volume-1" created
To check out the available volumes, you can use the persistentvolumes resource type, or pv for short:
> kubectl get pv NAME: persistent-volume-1 CAPACITY: 1Gi ACCESS MODES: RWO RECLAIM POLICY: ...
Read now
Unlock full access