Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] persistence.hostPath with a default storageClass not working. #256

Open
Florian7843 opened this issue May 7, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@Florian7843
Copy link

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"}}}'

@Florian7843 Florian7843 added the bug Something isn't working label May 7, 2023
@cloud27
Copy link

cloud27 commented Jun 2, 2023

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

@kooskaspers
Copy link

kooskaspers commented Jun 2, 2023

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.

@gnuion
Copy link

gnuion commented Mar 25, 2024

storageClassname: local-path

spec:
storageClassName: local-path

Capital N

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants