Tutorials:Persistent volumes on the Kubernetes cluster

From Collective Computational Unit
Revision as of 15:13, 18 June 2019 by Bastian.goldluecke (talk | contribs) (Persistent volumes)
Jump to navigation Jump to search

Persistent volumes

A persistent volume in Kubernetes is a cluster resource which can be requested by a container. For this, you have to claim a persistent volume (PV) using a persistent volume claim (PVC), which you apply in your namespace. The persistent volume claim can then be mounted to directories within a container. The important point is that the PVC survives the end of the container, i.e. the data in the PV will be permanent until the PVC is released. If the PVC is mounted again to a new container, the data will still be present.

On the cluster, there are two types of persistent volumes currently configured:

  • Local persistent volumes
  • Host directories


Local persistent volumes

These are persistent volumes which are mapped to special folders of the host filesystem of the node. Each node exposes several persistent volumes which can be claimed. The user can not control exactly which volume is bound to a claim, but can request a minimum size. A persistent volume claim (PVC) is configured like this:

> kubectl config use-context me@ccu

The following storage classes are configured in the cluster:



When the claim is defined to your satisfaction, apply it like this:

> kubectl config use-context me@ccu

You can check on the status of the claim:

> kubectl config use-context me@ccu

Since the claim has not been used by a container yet, it is not yet bound to a persitent volume (PV).

Host directories

Large training data sets which are required by many different users are stored permanently in the filesystem of several nodes. They can be claimed with a PVC as follows:

> kubectl config use-context me@ccu