Skip to content

Persistent Storage in Kubernetes

By default, the filesystem of a Kubernetes pod is ephemeral. If a pod is terminated or rescheduled to a different node, any data written to its local filesystem is lost. To run stateful applications like databases, message queues, or content management systems, you need a way to store data that persists independently of the pod's lifecycle.

The Contain Platform provides a robust and flexible storage solution that integrates with the underlying infrastructure to provide reliable persistent storage for your applications.

Further Reading

This guide covers the core concepts you need to get started. For a more exhaustive deep-dive, please refer to the official Kubernetes Storage documentation.

Core Storage Concepts

Kubernetes abstracts away the underlying storage infrastructure through a set of powerful API objects.

  • PersistentVolume (PV): A PV is a "slice" of storage in the cluster that an administrator provisions or that Kubernetes provisions dynamically using a StorageClass. It is a resource in the cluster, just like a node is a cluster resource. PVs have a lifecycle independent of any individual pod that uses the PV.

  • PersistentVolumeClaim (PVC): A PVC is a request for storage by a user. It is like a pod. Pods consume node resources, and PVCs consume PV resources. Your application's Deployment or StatefulSet will reference a PVC to mount the storage into its pods.

  • StorageClass: A StorageClass provides a way for administrators to describe the "classes" of storage they offer. Different classes might map to different quality-of-service levels, backup policies, or arbitrary policies determined by the cluster administrators. When you create a PVC, you specify which StorageClass you want, and the platform's CSI (Container Storage Interface) driver automatically provisions a PV that matches that class.

On the Contain Platform, for clusters running in our data centers, storage is provided by the VMware CSI driver.

Storage Portability

When you deploy a stateful application (typically using a StatefulSet), the persistent storage is tied to the lifecycle of the PersistentVolumeClaim, not the pod. If a pod fails or a node is drained for maintenance, Kubernetes will automatically reschedule the pod to a healthy node. The platform ensures that the original PersistentVolume is safely detached from the old node and re-attached to the new node, so your application can start up exactly where it left off, with all its data intact.

How to Provision and Manage Storage

See Getting Started with Block Storage for more information.

Available Storage Classes

Contain Platform Data Centers

See Storage Classes for more information.

Public Cloud Providers

If your cluster is running on a public cloud provider like AWS, Azure, or Google Cloud, you should use the native StorageClasses provided by that platform (e.g., gp2 on AWS, managed-premium on Azure). These classes are optimized for the cloud provider's infrastructure and give you access to their full range of storage features. Please refer to your cloud provider's official documentation for a list of available StorageClasses.