Skip to content

Writing Hub: StatefulSet Storage HA via Mutating Webhook#8

Open
Vinh1507 wants to merge 2 commits intocloudnativevn:mainfrom
Vinh1507:feat/writing-hub-statefulset-multi-storageclass
Open

Writing Hub: StatefulSet Storage HA via Mutating Webhook#8
Vinh1507 wants to merge 2 commits intocloudnativevn:mainfrom
Vinh1507:feat/writing-hub-statefulset-multi-storageclass

Conversation

@Vinh1507
Copy link
Copy Markdown

Event

Writing Contest 2026
Topic: Kubernetes Operations & Maintenance

Summary

StatefulSet only allows one storageClassName across all pods. In environments where each StorageClass maps to a distinct storage pool, this means all replicas share the same failure domain — defeating the purpose of HA replication.

This article walks through the problem and a practical fix: a Mutating Admission Webhook that intercepts PVC creation and assigns a different StorageClass to each pod based on its ordinal. Opt-in via a label on volumeClaimTemplates, no changes to the StatefulSet spec required.

Coverage

  • Root cause: why one StorageClass can become a single failure domain
  • Webhook design decisions
  • Full implementation: Flask webhook, cert-manager TLS, MutatingWebhookConfiguration, StatefulSet manifest
  • Verification steps
  • Extended scenarios: tier assignment by volume template name (data → SSD, log → HDD), SLO-based selection, role-aware assignment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant