StatefulSet Manifest Validation

Validate Kubernetes StatefulSet manifests. Check for proper service name, volume claim templates, and container configurations specific to stateful workloads.

Workload Types

Detailed Explanation

StatefulSet Configuration

StatefulSets manage stateful applications that need stable network identities and persistent storage. They have specific requirements beyond standard Deployments.

Example StatefulSet

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  serviceName: postgres-headless
  replicas: 3
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 999
        fsGroup: 999
      containers:
        - name: postgres
          image: postgres:16.1
          ports:
            - containerPort: 5432
              name: postgres
          resources:
            requests:
              cpu: 500m
              memory: 1Gi
            limits:
              cpu: 2000m
              memory: 2Gi
          livenessProbe:
            exec:
              command: ["pg_isready", "-U", "postgres"]
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            exec:
              command: ["pg_isready", "-U", "postgres"]
            initialDelaySeconds: 5
            periodSeconds: 5
          volumeMounts:
            - name: data
              mountPath: /var/lib/postgresql/data
  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 10Gi

StatefulSet Specifics

Field Purpose Important Because
serviceName Headless Service for DNS Required for stable network IDs
volumeClaimTemplates Per-pod PVC creation Data persists across restarts
podManagementPolicy OrderedReady or Parallel Controls rollout order
updateStrategy RollingUpdate or OnDelete Controls update behavior

Key Differences from Deployments

  • Pods get stable hostnames: <name>-0, <name>-1, etc.
  • Pods are created and deleted in order (by default)
  • PVCs are not deleted when StatefulSet is deleted
  • A headless Service (clusterIP: None) is needed for DNS records

The validator checks StatefulSet containers just like Deployment containers — resource limits, probes, security context, and image tags all apply equally.

Use Case

Validating database, message queue, and other stateful workload configurations before deployment. StatefulSets require more careful configuration than stateless Deployments.

Try It — K8s Manifest Validator

Open full tool