02/08/2026
Container အပိုင်း(၃၀)
K8s networking
——-
📚 IT နည်းပညာများကို လေ့လာချင်ပါသလား?
🎓 Techies Training Center မှ
✅ Python Programming (PCAP,PCEP,PCPP1,PCPP2)
✅ Python Streamlit framework course
✅ Kubernetes & Cloud Computing
✅ AWS, Azure, Google Cloud, Oracle Cloud
✅ Linux System Administration
✅ Cyber Security
✅ Oracle Database Administration
သင်တန်းများကို online video training တက်ရောက်နိုင်ပါသည်။
📩 သင်တန်း တက်ချင်ရင် Messenger မှ စုံစမ်းနိုင်ပါသည်။
———
Kubernetes Networking ဆိုတာဘာလဲ?
Kubernetes (K8s) မှာ Networking က Pod တွေ၊ Service တွေ၊ Node တွေနဲ့ External User တွေ အချင်းချင်း ဆက်သွယ်နိုင်အောင် လုပ်ပေးတဲ့ အရေးကြီးဆုံး Component တစ်ခုဖြစ်ပါတယ်။
Kubernetes Networking Design မှာ အဓိက Principle (၄) ခုရှိပါတယ်။
* Pod တစ်ခုက အခြား Pod တစ်ခုကို NAT မလိုဘဲ တိုက်ရိုက်ဆက်သွယ်နိုင်ရမယ်။
* Node တစ်ခုက Pod အားလုံးကို တိုက်ရိုက် Reach လုပ်နိုင်ရမယ်။
* Pod တစ်ခုမှာ Unique IP Address ရှိရမယ်။
* Container တွေအချင်းချင်း Localhost (127.0.0.1) နဲ့ ဆက်သွယ်နိုင်ရမယ်။
⸻
Kubernetes Networking Architecture
Internet
|
Ingress / LoadBalancer
|
+---------------------------+
| Kubernetes Cluster |
| |
| Service (ClusterIP) |
| | |
| +----+-----+ |
| | | |
| Pod A Pod B |
| |
| Node 1 Node 2 |
+---------------------------+
Networking Flow က
External User → Ingress → Service → Pod
ဖြစ်ပါတယ်။
⸻
Pod Networking
Pod က Kubernetes ရဲ့ Smallest Deployable Unit ဖြစ်ပါတယ်။
Pod တစ်ခုစီမှာ
* Unique IP Address
* Shared Network Namespace
* Shared localhost
ရှိပါတယ်။
ဥပမာ
Pod A
IP : 10.244.1.5
Pod B
IP : 10.244.2.8
Pod A က
curl 10.244.2.8
လို တိုက်ရိုက် Access လုပ်နိုင်ပါတယ်။
Pod Restart ဖြစ်သွားရင် IP ပြောင်းနိုင်တာကြောင့် Production မှာ Pod IP ကို တိုက်ရိုက်အသုံးမပြုသင့်ပါ။
⸻
CNI (Container Network Interface)
Kubernetes က Networking ကို Default မပေးထားပါဘူး။
Networking ကို CNI Plugin က Handle လုပ်ပါတယ်။
နာမည်ကြီး CNI Plugin များ
* Calico
* Flannel
* Cilium
* Weave Net
* Canal
⸻
Flannel
အားသာချက်
* Install လုပ်ရလွယ်
* Lightweight
* Small Cluster အတွက်သင့်တော်
အားနည်းချက်
* Network Policy မပါ
⸻
Calico
Enterprise မှာ လူသုံးများဆုံး။
Features
* Network Policy
* BGP Routing
* VXLAN
* IP-in-IP
* High Performance
⸻
Cilium
eBPF Technology အသုံးပြုထားပါတယ်။
Advantages
* Fast Performance
* Advanced Security
* Deep Network Visibility
* Observability
ယနေ့ Kubernetes Production Environment အများစုမှာ Cilium ကို အသုံးပြုလာကြပါတယ်။
⸻
Kubernetes Service
Pod IP က Dynamic ဖြစ်တာကြောင့် Service ကို အသုံးပြုပါတယ်။
Service Types
1. ClusterIP
Default Service ဖြစ်ပါတယ်။
Cluster အတွင်းက Pod တွေပဲ Access လုပ်နိုင်ပါတယ်။
App A
|
ClusterIP
|
Backend Pods
⸻
2. NodePort
Node IP + Port ကနေ Access လုပ်နိုင်ပါတယ်။
ဥပမာ
192.168.1.10:30080
Production မှာတော့ သိပ်မသုံးကြပါဘူး။
⸻
3. LoadBalancer
Cloud Provider
* AWS
* Azure
* GCP
* Oracle Cloud
တွေမှာ External Load Balancer တစ်ခုဖန်တီးပေးပါတယ်။
Internet
|
AWS ELB
|
Service
|
Pods
⸻
4. ExternalName
External DNS ကို Map လုပ်ပေးပါတယ်။
ဥပမာ
database.company.com
⸻
kube-proxy
Service Networking ကို Handle လုပ်ပါတယ်။
Modes
* iptables
* IPVS
Responsibilities
* Load Balancing
* Service Discovery
* Packet Forwarding
⸻
Ingress
Ingress က HTTP/HTTPS Traffic ကို Manage လုပ်ပါတယ်။
Internet
|
Ingress Controller
|
+------------+
| |
App1 App2
ဥပမာ
app.company.com
→ App1
api.company.com
→ App2
Ingress Controller များ
* NGINX Ingress
* Traefik
* HAProxy
* Kong
* AWS ALB Controller
⸻
DNS
Kubernetes Cluster မှာ CoreDNS ပါပါတယ်။
ဥပမာ
mysql.default.svc.cluster.local
Pod က
mysql
ဆိုပြီး DNS Resolve လုပ်နိုင်ပါတယ်။
⸻
Network Policy
Pod တွေအချင်းချင်း ဘယ်သူ Access လုပ်လို့ရမလဲကို Control လုပ်ပါတယ်။
ဥပမာ
Frontend
|
Allowed
|
Backend
Database
Only Backend Access
ဒီလို Rule တွေ သတ်မှတ်နိုင်ပါတယ်။
* Allow
* Deny
* Namespace Based
* Label Based
Production မှာ Network Policy အသုံးပြုခြင်းက Security အတွက် အလွန်အရေးကြီးပါတယ်။
⸻
Traffic Flow Example
User
↓
Load Balancer
↓
Ingress
↓
Service
↓
Pod
↓
Database
ဒီ Flow ကို နားလည်ထားရင် Kubernetes Networking ရဲ့ 80% ကျော်ကို နားလည်နိုင်ပါတယ်။
⸻
Troubleshooting Commands
Pod IP စစ်ရန်
kubectl get pods -o wide
Service စစ်ရန်
kubectl get svc
Endpoints စစ်ရန်
kubectl get endpoints
DNS စမ်းရန်
kubectl exec -it nginx -- nslookup kubernetes.default
Logs ကြည့်ရန်
kubectl logs
Node Information
kubectl get nodes -o wide
⸻
Best Practices
* Pod IP ကို Hardcode မလုပ်ပါနှင့်။
* Service ကို အသုံးပြုပါ။
* Production မှာ Ingress အသုံးပြုပါ။
* Network Policy Enable လုပ်ပါ။
* Calico သို့မဟုတ် Cilium ကဲ့သို့သော Enterprise-grade CNI ကို ရွေးချယ်ပါ။
* CoreDNS Health ကို အမြဲ Monitor လုပ်ပါ။
* kubectl exec, curl, nslookup နဲ့ Connectivity ကို စစ်ဆေးတတ်ပါစေ။
⸻
အနှစ်ချုပ်
Kubernetes Networking ကို နားလည်ဖို့ အရေးကြီးတဲ့ Components တွေက
* Pod
* CNI
* Service
* kube-proxy
* Ingress
* DNS (CoreDNS)
* Network Policy
တို့ဖြစ်ပါတယ်။
ဒီ Components တွေ ဘယ်လိုပူးပေါင်းပြီး User Request → Load Balancer → Ingress → Service → Pod → Database ဆိုတဲ့ Traffic Flow ကို အလုပ်လုပ်စေသလဲဆိုတာ နားလည်သွားပြီဆိုရင် Kubernetes Networking ရဲ့ အခြေခံ Concept ကို ကောင်းကောင်း သဘောပေါက်နိုင်ပါပြီ။
Production Environment မှာတော့ Networking Performance၊ Security နဲ့ Observability အတွက် Cilium (eBPF) သို့မဟုတ် Calico ကို အသုံးပြုခြင်းက ယနေ့ခေတ် Best Practice တစ်ခုဖြစ်ပါတယ်။