Sunday, September 26, 2021

What I learned about Kubernetes - (Scheduling - DaemonSets)

                 ဒီ article ကလဲ​ scheduling ရဲ့ အဆက်ပဲဖြစ်ပြီး daemonsets, static pods တို့အကြောင်းကို လေ့လာမှာဖြစ်ပါတယ်။ အရင်ဆုံး daemonsets အကြောင်း ပြောကြမယ်။ 

What is daemonsets?

                Daemonsets ရဲ့ အလုပ်လုပ်ပုံက deployment တို့ replicaset တို့လိုပဲ pods တွေကို multiple nodes တွေပေါ်မှာ တည်ဆောက်ပေးပါတယ်။ ကွဲပြား သွားတဲ့ အချက်ကတော့ daemonsets pod တွေက အဓိက အားဖြင့် monitoring, log collecting and network communication between nodes တွေ အတွက် အဓိက ထားအသုံးပြုပါတယ်။ ဥပမာ ရုံးက end-users တွေရဲ့ computers မှာ virus မ၀င်အောင် ကာကွယ်တဲ့ အနေနဲ့ endpoint security ( kaspersky endpoint security တို့ , trendmicro, etc) စသည်ဖြင့် သုံးကြတယ်။ ရုံး အနေနဲ့ ဒီ users တွေရဲ့ PC တွေ ကို တစ်ခု ချင်းစီ လိုက် manage လုပ်ဖို့က မဖြစ်နိုင်ဘူး အဲ့ဒီ အခါမှာ endpoint security agent လေးတွေ ကို PC တိုင်းမှာ install လုပ်တယ် ပြီးတော့မှ endpoint security server ကနေ တစ်ဆင့် monitor လုပ်တယ် update လုပ်တယ် logs တွေ collect စသည်ဖြင့် လုပ်ကြတာဖြစ်ပါတယ်။ အခု daemon set ရဲ့ အလုပ်လုပ်ပုံ ကလဲ​ အလားတူပဲ kubernetes nodes တွေပေါ်မှာ တူညီတဲ့ pod လေးတွေ deploy လုပ်ထားတယ်။ တူညီတဲ့ pod တွေဆိုတာ mornitor လုပ်မယ့် pod, log collect လုပ်မယ့် pod, nodes အချင်းချင်း ဆက်သွယ် ဖို့အတွက် ကူညီ ပေးတဲ့ pod စသည်ဖြင့် deploy လုပ်ထားတာကို ဆိုလိုပါတယ်။ 

                    အောက်ပုံမှာဆိုရင်  kube-proxy, flannel services, kube-keepalive-vip စတာတွေက daemonsets ကိုအသုံးပြုပြီး  deploy လုပ်ထားတဲ့ pod တွေဖြစ်ပါတယ်။ Cluster အတွင်းကို node အသစ် ရောက်လာတာနဲ့ daemonsets pod တွေက  new node ပေါ်မှာ create သွားဖြစ်မှာ ဖြစ်ပါတယ်။ အကယ်၍ node delete ဖြစ်သွားရင်လဲ auto delete ဖြစ်သွားမှာ ဖြစ်ပါတယ်။





So, how does daemonsets make sure its run on every nodes?

                Documentation မှာတော့ kubernetes v.12 မတိုင်ခင်အထိတော့ deamonset pods တွေမှာ node ကို manual define လုပ်ပြီး default scheduler ကို မသုံးပဲ bypass လုပ်ပြီး အသုံးပြုပါတယ်။ v.12 နောက်ပိုင်းမှာတော့ အရင် article တွေမှာ ပြောထားတဲ့ node affinity နဲ့  default scheduler ကို သုံးပြီး nodes တွေပေါ်မှာ run စေပါတယ်။ More on ref : https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/

Let's demo on daemonsets 

            demo အနေနဲ့ nginx pod ကိုပဲ daemonsets အနေနဲ့ ပြသွားပါမယ်။ Kubernetes documentation မှာလဲ​ daemonsets deployment ကို ကြည့်လို့ရပါတယ်။ kubectl create command ကို သုံးပြီး deploy လုပ်ပါမယ်။ ပြီးရင် kubectl get ds command ဖြင့် daemonsets pod status ကိုကြည့်လို့ရမယ်။ --all-namespace ဆိုပြီးတော့လဲ namespace တိုင်းမှာ ရှိတဲ့ daemonsets pod တွေကို ကြည့်နိုင်ပါတယ်။













        Ok, ဒါကတော့ daemonsets အကြောင်းလေးပဲဖြစ်ပါတယ်။

That's it 😊

Pls Like and Subscribe Our Root Of Info FB Page and Youtube Channel



Thank you!!!


Share:

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.