Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

k8s. Configure storageclass per namespace

Tags:

kubernetes

Is it possible to configure which storageclasses can be used by namespace?

So for example I have a single cluster for production and development.

I want to configure a set of storageclasses for development and a different set of storageclasses for production.

I want to strictly configure that in development no one could use the storageclasses of production.

Is this possible?

I have only seen the option to use the resource quotas at namespace level, but it is not the same, with quotas I can configure the amount of disk that can be used in each storageclass, so if I create a new storageclass I will have to modify all the quotas in all the namespaces to add the constraints about the new storageclass.

like image 387
Jxadro Avatar asked Jan 16 '19 08:01

Jxadro


People also ask

Are storage classes Namespaced?

StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.


1 Answers

A storage class in Kubernetes is a cluster-wide resource, so you can't restrict the usage regarding a namespace out-of-the-box. What you can do, however, is to write a customer controller akin to what Banzai did with their PVC Operator or Raffaele Spazzoli's Namespace Configuration Controller.

like image 190
Michael Hausenblas Avatar answered Nov 16 '22 00:11

Michael Hausenblas