Skip to main content
RunBook Academy

KubernetesLI · StorageClassesStorageClasses

The default StorageClass — implicit bindings and the production risk

Advanced⏱ ~16 minkubectl

What you'll learn

  • Describe how the default StorageClass is selected and applied
  • Identify the production risks of relying on defaults
  • Apply the discipline for explicit StorageClass references
  • Configure the default StorageClass correctly for multi-tenant clusters

Prerequisites

Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16

Not yet marked complete on this device.

The default StorageClass is the implicit binding target for PVCs that do not specify storageClassName. It is useful for development; it is dangerous for production. This lesson walks the default, its risks, and the production discipline.

How the default is selected

The default StorageClass is set by an annotation:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"

Only one StorageClass can be the default at a time. The binding controller treats the default as the implicit storageClassName for any PVC that does not specify one:

# PVC without storageClassName — binds to the default
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data
spec:
  accessModes: ["ReadWriteOnce"]
  resources:
    requests:
      storage: 10Gi

The binding controller sees no storageClassName and uses the cluster default.

The production risk

The risk of relying on the default:

  • Implicit dependency: a workload’s storage behavior depends on a cluster-wide annotation. Changing the default changes every unbound PVC’s behavior.
  • Inconsistency across environments: the default in staging may be standard; the default in production may be premium. A workload deployed via the same Helm chart binds to different backends.
  • Hidden cost: a PVC without explicit StorageClass may bind to a premium tier, incurring unexpected costs.
# Find PVCs relying on the default
kubectl get pvc -A -o json | \
  jq '.items[] | select(.spec.storageClassName == null) |
    {name: .metadata.name, namespace: .metadata.namespace}'

The output is the list of PVCs that should specify their StorageClass explicitly.

The discipline

The production discipline:

  • Every production PVC specifies storageClassName. No implicit defaults.
  • The default StorageClass is for development. New namespaces can use it; production namespaces must not.
  • Audits catch implicit bindings. A regular audit (e.g., weekly) finds PVCs without storageClassName and remediates them.

Changing the default

To set a new default:

# Set the new default
kubectl annotate storageclass new-default \
  storageclass.kubernetes.io/is-default-class="true" --overwrite

# Remove the old default
kubectl annotate storageclass old-default \
  storageclass.kubernetes.io/is-default-class="false" --overwrite

Existing PVCs that were bound to the old default are not affected; only new PVCs without storageClassName will bind to the new default.

Disabling the default

To disable the default entirely (force all PVCs to be explicit):

# Name of the StorageClass currently marked default:
SC=standard

# Remove the is-default-class annotation
kubectl annotate storageclass "$SC" \
  storageclass.kubernetes.io/is-default-class="false" --overwrite

# Or, delete the default StorageClass
kubectl delete storageclass "$SC"

After this change, any PVC without storageClassName is Pending. The operator sees the error and remediates by specifying a StorageClass.

Quiz

Knowledge check · 4 questions

  1. Q1. A PVC is submitted without `storageClassName`. What determines where it binds?

  2. Q2. Changing the cluster's default StorageClass affects PVCs that were already bound.

  3. Q3. Your team inherits a cluster where many production PVCs rely on the default StorageClass. Walk through the remediation.

    Audit finds 20 production PVCs across 5 namespaces without explicit storageClassName. The default StorageClass is `standard` (gp3). Production requires `db-ssd` (io2).

  4. Q4. Explain why relying on the default StorageClass is a production anti-pattern and what the discipline is.

Passing score: 75%. Answers are checked in this browser.

Production discipline

  • Every production PVC specifies storageClassName. No implicit defaults.
  • The default StorageClass is for development. It is not used by production workloads.
  • Audit PVCs for implicit bindings. Weekly or monthly audits catch PVCs without explicit StorageClass.
  • Changing the default is a cluster-wide change. Communicate; document; audit the impact.
  • Consider disabling the default. Force every PVC to be explicit; prevent accidental implicit bindings.