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 Google Cloud SQL, Cloud Datastore, or Cloud Spanner. You can use Google Cloud Storage for object storage. Store your private Docker container images in Container Registry.
Use Filestore if your application requires managed Network Attached Storage (NAS). For POSIX-compatible file storage, you can use a file server on Compute Engine. If your application requires block storage, use persistent disks. You can provision Persistent Disks manually, or let Kubernetes dynamically provision disks for you (see PersistentVolumes below).
Refer to the Choosing a storage option guide for a complete listing and comparison of storage solutions available on Google Cloud.
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 are cluster resources that Pods can use for durable storage. PersistentVolumesClaims can be used to dynamically provision Persistent Volumes backed by Compute Engine persistent disks for use in your cluster. You can also use PersistentVolumeClaims to provision other types of backing storage like NFS.