Myth: Kubernetes Cluster Can Have Only One Default StorageClass
You're defining a new StorageClass and set:
metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "true"
So you apply multiple StorageClass resources with the same default annotation — and nothing happens. No error. No warning.
You run:
kubectl get sc -o custom-columns=NAME:.metadata.name,DEFAULT:.metadata.annotations.storageclass\.kubernetes\.io/is-default-class
Why This Myth Exists?
- The term “default” creates the impression that only one can exist.
- Most tutorials and cluster setups only define one, reinforcing this assumption.
- The lack of enforcement is not widely documented.
- Engineers expect the system to prevent ambiguous behavior—but Kubernetes allows it.
The Reality
You can create multiple default StorageClasses in a Kubernetes cluster.
The "storageclass.kubernetes.io/is-default-class": "true" annotation is not enforced by Kubernetes — it's simply a marker.
- When a PVC omits storageClassName, the system looks for a StorageClass with that annotation.
- If more than one exists, the behavior is undefined and provider-specific.
- Kubernetes does not raise any warning or error when multiple defaults exist.
- It's up to cluster admins to ensure only one default exists for consistent PVC provisioning.
Experiment & Validate
Step 1: Create Two Default StorageClasses
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-default
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/no-provisioner
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: slow-default
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/no-provisioner
kubectl apply -f dual-default-sc.yaml
kubectl get sc -o custom-columns=NAME:.metadata.name,DEFAULT:.metadata.annotations.storageclass\.kubernetes\.io/is-default-class
Key Takeaways
- Kubernetes allows multiple default StorageClasses without any warning.
- The “default” is an annotation, not a rule.
- If more than one default exists, PVCs without storageClassName may be handled unpredictably.
- Always ensure only one default StorageClass exists to avoid confusion.