Open Florian7843 opened 1 year ago
Hello, I have the same problem with the persistence.hostPath with K3s. For information set persistence.storageClass to - doesn't resolve the issue.
Anyone find a solution ?
Thanks
This is my solution:
Edit the yaml of the persistent volume (pv) and add below the 'spec' section:
storageClassname: local-path
Reapply the configuration and the pvc should bind with the pv again.
storageClassname: local-path
spec: storageClassName: local-path
Capital N
Describe the bug When using the
persistence.hostPath
value and having a default storageClass defined in the Kubernetes cluster. The final PVC will still have the storageClassName with the value of the default storageClass attached. This results in the following error/warning event:Cannot bind to requested volume "mailu-storage": storageClassName does not match
Environment K3s Kubernetes cluster with Longhorn set as default storage class.
Additional context Problem can be avoided by removing the default attribute from the storageClass with the following command:
kubectl patch storageclasses.storage.k8s.io <YOUR_CURRENT_DEFAULT_STORAGECLASS> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'