Ek controller gap ko watch karta hai aur action leta hai jab tak gap zero na ho jaye. Yahi reason hai ki Kubernetes declarative hai, imperative nahi: tum "container start karo" nahi bolte, tum bolte ho "mujhe 3 copies running chahiye" aur yeh use maintain karta hai.
HOW pods behave karte hain: Pods ephemeral aur mortal hote hain. Inhe ek Pod IP milta hai, lekin agar ek Pod mar jaye toh use same identity ke saath resurrect nahi kiya jata — ek naya Pod ek naye IP ke saath appear hota hai. Yeh sabse important fact hai:
HOW rolling update kaam karta hai (safety derive karo):
Tumhare paas replicas = R hai. Update strategy mein do knobs hain:
maxUnavailable = ek time pe kitne Pods down ho sakte hain
maxSurge = kitne extra Pods temporarily create ho sakte hain
Update ke dauran available Pods P ki sankhya satisfy karti hai:
R−maxUnavailable≤PavailableandPtotal≤R+maxSurge
Toh capacity kabhi R−maxUnavailable se neeche nahi giregi → zero-downtime upgrade. Agar nayi version broken hai, tum rollback karte ho aur Deployment purani ReplicaSet ke Pods dobara create kar deta hai.
Kubernetes mein sabse chhota deployable unit kya hai?
Ek Pod (ek ya zyada containers jo network namespace aur storage share karte hain).
Pod ka IP hardcode kyun nahi karna chahiye?
Pods ephemeral hote hain; restart/reschedule/scale karne se naye Pod ko naya IP milta hai. Stable address ke liye Service use karo.
Deployment kya manage karta hai aur kis zariye?
Identical Pods ka ek set, ek ReplicaSet ke zariye, desired replica count maintain karta hai aur rolling updates/rollbacks handle karta hai.
Service ko kaise pata chalta hai ki traffic kaun se Pods ko bhejna hai?
Label selector ke zariye; yeh matching healthy Pods ke IPs (Endpoints) track karta hai aur unke beech load-balance karta hai.
Teeno main Service types aur unki reach batao.
ClusterIP (sirf internal), NodePort (har node ki IP pe port), LoadBalancer (external cloud LB public IP ke saath).
Ingress kya karta hai jo Service nahi kar sakta?
L7 (HTTP) routing by host/path aur TLS termination, bahut saari Services ko ek entry point ke zariye expose karna.
Rolling update ki safety kaun se do knobs control karte hain?
maxUnavailable (kitne Pods down ho sakte hain) aur maxSurge (kitne extra Pods create ho sakte hain).
Reconciliation loop kya hai?
Kubernetes continuously desired state aur observed state ke beech gap close karne ke liye act karta hai (declarative model).
Har Service ke liye ek LoadBalancer ki jagah Ingress kyun use karein?
Har Service ke liye ek LB costly hai; Ingress ek single entry point deta hai jo URL se bahut saari Services route karta hai.
Actual Ingress rules kaun run karta hai?
Ek Ingress Controller (e.g. nginx, Traefik) — rules iske bina kuch nahi karte.
Recall Feynman: ek 12-saal ke bacche ko samjhao
Ek pizza shop imagine karo. Pods cooks hain — woh actually pizzas banate hain, lekin koi bhi cook beemar pad sakta hai aur naya le leta hai uski jagah. Deployment manager hai jo ensure karta hai ki hamesha, maan lo, 3 cooks kaam kar rahe hoon, aur ek-ek karke naye trainees ko train kare taki kitchen kabhi band na ho. Service shop ka phone number hai — yeh kabhi nahi badlta even when cooks badalte hain, aur tumhari call jo bhi cook free ho usse route karta hai. Ingress aage ka darwaza hai signs ke saath: "Pizza → kitchen, Drinks → bar", har customer ko sahi counter pe bhejta hai. Tum bas manager ko bolte ho "mujhe 3 cooks chahiye", aur Kubernetes hamesha ke liye yeh sach rakhta hai.