infraly / k8s-on-openstack

An opinionated way to deploy a Kubernetes cluster on top of an OpenStack cloud.
Apache License 2.0
112 stars 48 forks source link

Set a default storage class for PV/PVCs to function correctly #52

Closed pfisterer closed 4 years ago

pfisterer commented 5 years ago

Hi all, Do you think it makes sense to (optionally) define a default storage class for dynamically creating OpenStack volumes to work out of the box?

Currently, after creating the cluster, I've used the following YAML-file to set the DefaultStorageClass for dynamic provisioning to work:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: my-default-class
  annotations:
    storageclass.beta.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/cinder
parameters:
  availability: nova

The documentation also states the following:

To enable dynamic storage provisioning based on storage class, the cluster administrator needs to enable the DefaultStorageClass admission controller on the API server. This can be done, for example, by ensuring that DefaultStorageClass is among the comma-delimited, ordered list of values for the --enable-admission-plugins flag of the API server component. For more information on API server command line flags, please check kube-apiserver documentation.

This is sth that should be checked in files/kubeadm-init.yaml.j2.

apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
apiServerExtraArgs:
  enable-admission-plugins: NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,DefaultStorageClass, etc.

Sorry for spamming you with issues and PRs - I'm currently trying to get everything to work.

Best, Dennis

ctrlaltdel commented 5 years ago

Yes it definitely looks like a useful feature.

No problem with spamming :)

pfisterer commented 4 years ago

@ctrlaltdel ok, I've created a PR (#55).