Creating an SSD persistent volume in Google Kubernetes Engine

Posted January 1, 2018 by  ‐ 2 min read

In my humble opinion, Google Kubernetes Engine (previously known as Google Container Engine) is the best kubernetes implementation among all the cloud providers. It is THE easiest to set up as well. Because of that, we’ve been using GKE extensively on many of our projects. And recently, I came across a use case that is not documented at all (at least I couldn’t find any documentation) - Using an SSD with Persistent Volume (PV) in GKE

Turns out, it is not very straight forward. So, I decided to write a blog post explaining just that.

Creating an SSD persistent volume in GKE

First of all, we need to add the SSD storage class so that you can start creating PVs from SSD.

Create ssd-storage-class.yml with the following content

kind: StorageClass
  name: ssd
  type: pd-ssd

Create the storage class

kubectl create -f ssd-storage-class.yml

Once that is done, make sure that the new storage class is created and ready to use

kubectl get sc

You should see something like below

➜ kubectl get sc
NAME                 TYPE
standard (default)

Great. We have created the storage class. Now all we can easily create persistent volumes using the newly created storage class


Create ssd-pv-demo.yml with the following contents

apiVersion: v1
kind: PersistentVolumeClaim
  name: ssd-pv-demo
    name: ssd-pv-demo
  accessModes: [ "ReadWriteOnce" ]
  storageClassName: ssd
      storage: 10Gi

the storageClassName is what defines whether the disk is an SSD or a standard drive.

Alright, that’s all.