CodexBloom - Programming Q&A Platform

Kubernetes StatefulSet Pod Not Starting Due to Persistent Volume Claim Issues on v1.26

๐Ÿ‘€ Views: 0 ๐Ÿ’ฌ Answers: 1 ๐Ÿ“… Created: 2025-06-17
kubernetes statefulset pvc minikube yaml

I'm optimizing some code but I'm testing a new approach and I'm currently working with an scenario with a StatefulSet where the pods are exploring in `ContainerCreating` state because they need to bind to their Persistent Volume Claims (PVCs). I'm running Kubernetes v1.26 on a local cluster using Minikube. Here is the relevant portion of my StatefulSet configuration: ```yaml apiVersion: apps/v1 kind: StatefulSet metadata: name: my-stateful-app spec: serviceName: "my-service" replicas: 3 selector: matchLabels: app: my-stateful-app template: metadata: labels: app: my-stateful-app spec: containers: - name: my-container image: my-image:latest ports: - containerPort: 80 volumeMounts: - name: my-storage mountPath: /data volumeClaimTemplates: - metadata: name: my-storage spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 1Gi ``` When I check the events for the pods, I see the following behavior messages: ``` Normal Scheduled 3m55s default-scheduler Successfully assigned default/my-stateful-app-0 to minikube Warning FailedMount 3m54s kubelet, minikube MountVolume.SetUp failed for volume "my-storage" : PersistentVolumeClaim "my-storage-0" not found ``` Iโ€™ve verified that the PVCs are supposed to be created automatically by the StatefulSet, but when I run `kubectl get pvc`, I donโ€™t see any claims being created. Iโ€™ve tried deleting the StatefulSet and recreating it, but that didn't help. I've also checked the storage class using the following command: ```bash kubectl get sc ``` It outputs: ``` NAME PROVISIONER AGE standard k8s.io/minikube-hostpath 10d ``` I'm not sure if it's a configuration scenario with my StatefulSet or if itโ€™s related to the underlying storage class. Any suggestions on how to resolve this PVC binding scenario so that my StatefulSet pods can start successfully? This is part of a larger CLI tool I'm building. This issue appeared after updating to Yaml 3.9. I'd love to hear your thoughts on this.