StatefulSets
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 = 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
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: postgresStatefulSet, 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.