How to upgrade StatefulSet in Kubernetes( spec: Forbidden: updates to statefulset spec for fields … )

Prabesh
3 min readMay 3, 2024

What is a StatefulSet?

In Kubernetes, StatefulSets are a workload API object used to manage stateful applications. Unlike stateless applications, which can be easily replicated and scaled horizontally, stateful applications maintain critical state information, such as databases or key-value stores. StatefulSets provide guarantees about the ordering and uniqueness of these instances during deployment, scaling, and deletion.

Key Features of StatefulSets:

  1. Stable Network Identifiers: Each Pod in a StatefulSet receives a stable network identity, allowing other Pods and services to discover and communicate with it reliably.
  2. Ordered Deployment and Scaling: StatefulSets maintain a consistent, predictable order during deployment and scaling operations, ensuring that Pods are instantiated and terminated sequentially.
  3. Persistent Storage: StatefulSets integrate seamlessly with PersistentVolumes (PVs) and PersistentVolumeClaims (PVCs), allowing stateful applications to store data persistently across Pod restarts and rescheduling.
  4. Headless Service: By default, StatefulSets are associated with a headless service, which means that…

--

--

Prabesh

Senior Site Reliability Engineer & Backend Engineer | Docker Captain 🐳 | Auth0 Ambassador @Okta | https://www.linkedin.com/in/prabeshthapa