kube-proxy (kubernate’s part 7)

Kubernetes में kube-proxy क्या है 🌐

Image

Image

Image

Image

1️⃣ kube-proxy क्या है

kube-proxy Kubernetes node पर चलने वाला networking component है जो services और pods के बीच network communication manage करता है।

One line (Interview):
👉 kube-proxy Kubernetes services के लिए networking और load balancing manage करता है।

2️⃣ kube-proxy क्यों होता है

Kubernetes में कई pods होते हैं।

Example:

Pod A
Pod B
Pod C

अगर कोई user या application service को access करे:

Service → Pods

तो request किस pod पर जाएगी?

👉 यही routing और load balancing kube-proxy manage करता है।

3️⃣ kube-proxy क्या-क्या काम करता है

1️⃣ Service networking manage करता है

Service IP को pods तक route करता है।

Example

Service IP → Pod IP

2️⃣ Load balancing करता है

अगर multiple pods हों:

Pod1
Pod2
Pod3

तो traffic distribute करता है।

3️⃣ Network rules create करता है

kube-proxy node में network rules बनाता है:

iptables
IPVS

इन rules से packets सही pod तक जाते हैं।

4️⃣ Cluster IP enable करता है

Service का virtual IP provide करता है जिससे pods communicate करते हैं।

4️⃣ kube-proxy किस-किस से connection रखता है

1️⃣ kube-apiserver (Direct)

kube-proxy API server से service और endpoint information लेता है।

kube-proxy → kube-apiserver

2️⃣ Pods (Indirect)

Traffic pods तक route करता है।

Service → kube-proxy → Pod

3️⃣ kubelet (Same Node)

Node के pods के साथ networking enable करता है।

4️⃣ etcd (Indirect)

Direct connection नहीं होता।

Flow:

kube-proxy
 ↓
kube-apiserver
 ↓
etcd

5️⃣ Real Example

अगर service create करें:

type: ClusterIP

Flow:

User request
 ↓
Service IP
 ↓
kube-proxy
 ↓
Pod1 / Pod2 / Pod3

6️⃣ One Line Memory Trick 🧠

👉 kube-proxy = Kubernetes services के लिए network routing और load balancing करने वाला component।

या

👉 kube-proxy routes service traffic to pods.

7️⃣ Kubernetes Architecture Super Trick 🔥

Control Plane

API Server → Gateway
etcd → Database
Scheduler → Pod placement
Controller Manager → Maintain state
Cloud Controller Manager → Cloud integration

Node Components

kubelet → Run pods
kube-proxy → Networking
Container Runtime → Run containers