There are several storage options for applications running on Google Kubernetes Engine (GKE). The choices vary in terms of flexibility and ease of use. Google Cloud offers several storage solutions that are specialized for different needs. Beyond these, Kubernetes provides storage abstractions which you can use to offer storage to your cluster.
The simplest storage options are Google Cloud's managed storage products.
If you need a database, consider Cloud SQL, Datastore, or Cloud Spanner. You can use Cloud Storage for object storage. Store your private container images, Helm charts, and other build artifacts in Artifact Registry.
If your application requires block storage, use persistent disks. You can provision persistent disks manually, or let Kubernetes dynamically provision disks for you (see Persistent volumes in the next section).
For a complete listing and comparison of storage solutions available on Google Cloud, see Choosing a storage option.
Kubernetes storage abstractions
Kubernetes storage abstractions provide filesystem and block-based storage to your Pods. They are not used with managed databases or Cloud Storage.
- Volumes are a storage unit accessible to containers in a Pod. Some volume types are backed by ephemeral storage. Ephemeral storage types (for example, emptyDir, ConfigMap, and Secrets) do not persist after the Pod ceases to exist. These types are useful for storing configuration information and as scratch space for applications. You can manage your local ephemeral storage resources as you do your CPU and memory resources. Other volume types are backed by durable storage.
- Persistent volumes
PersistentVolumeis a cluster resource that Pods can use for durable storage. A
PersistentVolumeClaimcan be used to dynamically provision a
PersistentVolumebacked by Compute Engine persistent disks for use in your cluster. You can also use a
PersistentVolumeClaimto provision other types of backing storage like NFS.