Amazon EKS
User Guide

Storage Classes

Amazon EKS clusters are not created with any storage classes. You must define storage classes for your cluster to use and you should define a default storage class for your persistent volume claims. For more information, see Storage Classes in the Kubernetes documentation.

To create an AWS storage class for your Amazon EKS cluster

  1. Create an AWS storage class manifest file for your storage class. The below example defines a storage class called gp2 that uses the Amazon EBS gp2 volume type. For more information about the options available for AWS storage classes, see AWS in the Kubernetes documentation. For this example, the file is called gp2-storage-class.yaml.

    kind: StorageClass apiVersion: metadata: name: gp2 provisioner: parameters: type: gp2 reclaimPolicy: Retain mountOptions: - debug
  2. Use kubectl to create the storage class from the manifest file.

    kubectl create -f gp2-storage-class.yaml


    storageclass "gp2" created

To define a default storage class

  1. List the existing storage classes for your cluster. A storage class must be defined before you can set it as a default.

    kubectl get storageclass


    NAME PROVISIONER AGE gp2 8m sc1 6s
  2. Choose a storage class and set it as your default by setting the annotation.

    kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"":"true"}}}'


    storageclass "gp2" patched
  3. Verify that the storage class is now set as default.

    kubectl get storageclass


    gp2 (default) 12m sc1 4m