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.
Managed options
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.
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.
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
- 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) do not persist after the Pod ceases to exist. These types are useful for 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
- A
PersistentVolume
is a cluster resource that Pods can use for durable storage. APersistentVolumeClaim
can be used to dynamically provision aPersistentVolume
backed by Compute Engine persistent disks for use in your cluster. You can also use aPersistentVolumeClaim
to provision other types of backing storage like NFS.