Reputation: 86327
I'm running Docker Desktop with Kubernetes.
I can ssh to the node and I have other pods running on the node.
However, when I apply a StatefulSet to the cluster I get:
0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
The Stateful Set is here:
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#components
kubectl get no
NAME STATUS ROLES AGE VERSION
docker-desktop Ready control-plane 6d2h v1.24.1
Upvotes: 10
Views: 53892
Reputation: 91
I was also facing the same issue with Mac Apple M1 Pro. I also found related issue on github. https://github.com/docker/for-mac/issues/2560
I was getting exact same error described in above github issue by following mentioned steps.
So as per suggestions in that thread, I have tried Reset Kubernetes cluster
, Clean/Purge Data
and Reset to Factory defaults
from Troubleshoot section. But none of them worked for me.
Finally, I have entirely uninstalled Docker desktop and reinstalled it again by downloading latest installer from official site, which has fixed the issue. Now, I am getting Bound
status instead of Pending
when I can pvc.
Upvotes: 0
Reputation: 9298
if your using k8s locally with docker desktop ensure that the storageClassName is set to "hostpath" below is one of my volumeClaimTemplates for a local redis cluster. The comment has saved me a few times when getting the "0/1 nodes are available" which is a confusing error
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
##############################
## this will catch you out ##
# for Docker Desktop (Local K8s Cluster) set to -> storageClassName: "hostpath"
##############################
storageClassName: "hostpath"
resources:
requests:
storage: 250Mi
Upvotes: 0
Reputation: 18411
If you are applying the manifest defined here as it is, the problem is in the below snippet, particularly with the storageClassName.
Likely, your cluster does not have a storage class called my-storage-class.
volumeClaimTemplates:
- metadata:
name: www
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "my-storage-class"
resources:
requests:
storage: 1Gi
To get the definitive error statement, you can run the following command:
kubectl describe pvc www-web-0
you will notice something like:
storageclass.storage.k8s.io "my-storage-class" not found
Solution:
You can run the following command to get your cluster's available storage class
and replace it in yaml file.
kubectl get sc
Alternatively, you can delete the storageClassName
and let the default storage class do the magic. However, for this to work, you must have a default sc present in your cluster.
If you have no storage class present, you need to create one. Check this out.
Upvotes: 7