26 Ekim 2018 Cuma

solving rancher 2.x setting default storageclass failure on gui

Hi everyone,
If you using rancher 2.x for kubernetes and and nfs-provisioner for storageclass and you cannot set nfs as your default storageclass you have to set this via kubectl.

You can do this by running this command in your main system.
kubectl patch storageclass nfs -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

If you getting an error like cannot connect host:8080 you must run kubectl with --kubeconfig param that resolves your kube_config_cluster.yml.

example usage:
 kubectl patch storageclass nfs -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' --kubeconfig=~/kube_config_cluster.yml

You also can add kube_config_cluster.yml as KUBECONFIG environment value by
export KUBECONFIG=/path/to/kube_config_cluster.yml
or adding in /etc/environment file for persistent usage.
Share:

0 yorum:

Yorum Gönder