Persistent Volumes¶
Claiming Volumes¶
Here is how to claim RBD volumes for use within a deployment.
Create a file claim.json spevifying the volume name and size:
{ "kind": "PersistentVolumeClaim", "apiVersion": "v1", "metadata": { "name": "myvol" }, "spec": { "accessModes": [ "ReadWriteOnce" ], "resources": { "requests": { "storage": "4Gi" } }, "storageClassName": "hdd" } }
Note the StorageClassName parameter which for our platform is “hdd”.
Execute the command:
$ kubectl create -f claim.json
Check that the 4GB volume “myvol” has been created:
$ kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE myvol Bound pvc-81c512af-91a9-11e8-b43d-74e6e266c8e1 4Gi RWO slow 17s
Deleting a Volume¶
Use this to delete a volume:
$ kubectl delete pvc myvol
persistentvolumeclaim "myvol" deleted