🗄️
Workloads

StatefulSets

Stateful Applications
💡 StatefulSet, EK, "NUMBERED, APARTMENT, BUILDING" jaisa, hai — HAR, APARTMENT, (pod) ka, EK, FIXED, NUMBER, hai, (pod-0, pod-1, pod-2) aur, agar, RESIDENT, (pod) badalta, bhi, hai, TO, USKA, APARTMENT, NUMBER, aur, ADDRESS, SAME, RAHTA, hai.

StatefulSet, un, applications, ke, liye, hai, JINHE, STABLE, UNIQUE, NETWORK, IDENTITY, aur, STABLE, PERSISTENT, STORAGE, chahiye — jaise, DATABASES, (Postgres, MySQL, MongoDB). HAR, pod, ko, EK, PREDICTABLE, NAAM, (pod-0, pod-1) aur, USKA, OWN, PERSISTENT, VOLUME, milta hai.

Deployment, ke, UNLIKE, StatefulSet, pods, EK, ORDERED, SEQUENCE, mein, START, aur, STOP, hote, HAIN (pod-0, PEHLE, phir, pod-1) — YE, DATABASE, CLUSTERS, jaise, systems, ke, liye, ZAROORI, hai, JAHAN, ORDER, MATTER, karta hai.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
spec:
  serviceName: postgres
  replicas: 3
  selector:
    matchLabels:
      app: postgres
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 10Gi
🗄️
StatefulSet, EK, "NUMBERED, APARTMENT, BUILDING" jaisa, hai — HAR, APARTMENT, (pod) ka, EK, FIXED, NUMBER, hai, (pod-0, pod-1, pod-2) aur, agar, RESIDENT, (pod) badalta, bhi, hai, TO, USKA, APARTMENT, NUMBER, aur, ADDRESS, SAME, RAHTA, hai.
1 / 2
⚡ Quick Recap
  • StatefulSet = stable identity + stable storage waali applications ke liye (databases)
  • Har pod ko predictable naam (pod-0, pod-1) aur apna persistent volume milta hai
  • Pods ordered sequence mein start/stop hote hain, Deployment ke unlike
On this page (2 subtopics)

StatefulSets, ko, EK, "headless, service" (clusterIP: None) ki, ZAROORAT, hoti, hai — YE, HAR, pod, ko, EK, INDIVIDUAL, STABLE, DNS, naam, DETA, hai (jaise, "postgres-0.postgres.default.svc.cluster.local") na, ki, EK, hi, SHARED, IP.

apiVersion: v1
kind: Service
metadata:
  name: postgres
spec:
  clusterIP: None
  selector:
    app: postgres

StatefulSet, scale, UP, karte, waqt, pods, ORDER, mein, banaye, jaate, HAIN, (0, 1, 2...) aur, scale, DOWN, karte, waqt, REVERSE, ORDER, mein, DELETE, hote, HAIN, (highest, index, PEHLE) — YE, database, clusters, ke, liye, PREDICTABLE, behavior, ENSURE, karta hai.