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
CodePudding user response:
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.