how to create st1 storageclass within a cluster deployed by kops?

5/1/2018

I deployed a cluster with kops, and then I listed the storage class:

kubectl get storageclass --all-namespaces
NAME            PROVISIONER             AGE
default         kubernetes.io/aws-ebs   2h
gp2 (default)   kubernetes.io/aws-ebs   2h

I want to make a PVC of type st1, how shall I do that?

-- Xiang Zhang
kops
kubernetes

1 Answer

5/1/2018

You can create storage classes like any other Kubernetes resource. For the st1 storage class, the following should work:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: st1
provisioner: kubernetes.io/aws-ebs
parameters:
  type: st1

You can find more information on storage classes in the documentation, and also in particular on using the kubenetes.io/aws-ebs provisioner.

If you then want to dynamically provision a volume using that class, use the storageClassName: st1 property when creating a PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: your-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: st1
  resources:
    requests:
      storage: 500Gi
-- helmbert
Source: StackOverflow