1

Summary

How do I adjust an existing storageclass or create a new storage class in Kops?

Background

We have a Kops provisioned cluster with the gp2 storageclass set up. We require the volumeBindingMode: WaitForFirstConsumer set so that pods requiring multiple volumes get them all in the same AZ; otherwise we get unschedulable pods because the underlying EBS volumes are in different availability zones.

Alternatively I can create a new storageclass manually with kubectl but the Kops docs are not clear on the process

  • Did you try to duplicate default storage class and add `Allowed Topologies` parameter as mention in [Kubernetes docs](https://kubernetes.io/docs/concepts/storage/storage-classes/#aws-ebs)? Parameters like `zone` and `zones` were deprecated. To confirm, you are using AWS, not GKE? – PjoterS Oct 23 '20 at 12:47
  • Indeed, we are using AWS. By "duplicate the default storage class" do you mean use kubectl to do it? I am trying to find a pure Kops way of doing this because I'd like to avoid an unmanaged storage class if possible. If have not found a way to tell Kops to make the storage class on my behalf. – Friedrich 'Fred' Clausen Oct 26 '20 at 00:58

1 Answers1

0

I guess you can try to introduce your own, user defined K8S storage class as a form of cluster addons, that can be specified as a part of the Cluster resource's spec (kept in KOPS's cluster S3 bucket state), e.g:

spec:
  addons:
  - s3://kops-addons/sc-gp2-us-east-2.yaml

At least this form can be used when bootstraping KOPS cluster directly from manifest file according to the official doc here.

To adhere your storage class to specific cloud compute zones please use 'allowedTopologies' as @PjoterS suggested.

Nepomucen
  • 306
  • 1
  • 4
  • Thanks, a cluster addon looks like the way to go. As for using "allowedTopologies": it's not that I need specific zones, rather, I just need the underling volumes to be in the same zone as the pod (whichever zone that ends up being) so I may not need to specifically spell out which zones when using `allowedTopologies`. – Friedrich 'Fred' Clausen Oct 26 '20 at 22:42