How do I resolve persistentvolumeclaims "hub-db-dir" is forbidden error while deploying jupyter hub on kubernetes?

5/9/2019

I want to deploy jupyter notebook on a kubernetes cluster. Following the official documentation(https://zero-to-jupyterhub.readthedocs.io/en/latest/setup-jupyterhub.html), I ran the following command:

# Suggested values: advanced users of Kubernetes and Helm should feel
# free to use different values.
RELEASE=jhub
NAMESPACE=jhub

helm upgrade --install $RELEASE jupyterhub/jupyterhub \
  --namespace $NAMESPACE  \
  --version=0.8.2 \
  --values jupyter-hub-config.yaml

Where jupyter-hub-config.yaml is a config file as mentioned in the doc, containing a token generated by the command openssl rand -hex 32 .

While running the aforementioned command, I get the following error:

Error: release jhub failed: persistentvolumeclaims "hub-db-dir" is forbidden: Internal error occurred: 8 default StorageClasses were found

I tried looking into various methods of installing jhub but none could point me to any difference in this approach that I would consider causing error here.

The o/p of the command kubectl get storageclass is:

NAME                                     PROVISIONER             AGE
aviral-worker-volume (default)           kubernetes.io/aws-ebs   14d
default (default)                        kubernetes.io/aws-ebs   14d
es-ebs-storage (default)                 kubernetes.io/aws-ebs   7d
gp2 (default)                            kubernetes.io/aws-ebs   14d
prometheus-monitoring-volume (default)   kubernetes.io/aws-ebs   8d
replicated (default)                     kubernetes.io/aws-ebs   14d
replicated-premkit (default)             kubernetes.io/aws-ebs   14d
replicated-statsd (default)              kubernetes.io/aws-ebs   14d
-- Aviral Srivastava
jupyter
jupyterhub
kubectl
kubernetes
kubernetes-helm

1 Answer

5/9/2019

You have 8 default storage classes in your cluster, which is definitely not normal. You should make sure you have only one default storage class.

I don't know which one should be default, it's totally up to your cluster, I don't wanna be responsible for that decision. But for all storage classes except the default you need to do this:

kubectl patch storageclass <your-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
-- Vasily Angapov
Source: StackOverflow