Static Pods, Manual Scheduling, Labels, and Selectors โ Kubernetes
Ibrahim S
Posted on July 31, 2024
๐น The ๐๐๐ฏ๐ฒ๐ฟ๐ป๐ฒ๐๐ฒ๐ ๐๐ฐ๐ต๐ฒ๐ฑ๐๐น๐ฒ๐ฟ is in charge of scheduling pods onto nodes.
๐น The K8s scheduler is not responsible for actually running the pod โก thatโs the ๐ธ๐๐ฏ๐ฒ๐น๐ฒ๐โ๐ job. So it just needs to make sure every pod has a node assigned to it. Kubernetes in general has this idea of a "controller".
๐น Node selection in kube-scheduler. kube-scheduler selects a node for the pod in a 2-step operation:
โ
Filtering
โ
Scoring
๐น The filtering step finds the set of Nodes where it's ๐ณ๐ฒ๐ฎ๐๐ถ๐ฏ๐น๐ฒ ๐๐ผ ๐๐ฐ๐ต๐ฒ๐ฑ๐๐น๐ฒ the Pod.
๐น In the scoring step, the ๐๐ฐ๐ต๐ฒ๐ฑ๐๐น๐ฒ๐ฟ ๐ฟ๐ฎ๐ป๐ธ๐ the remaining nodes to choose the most suitable Pod placement.
๐น The scheduler ๐ฎ๐๐๐ถ๐ด๐ป๐ ๐ฎ ๐๐ฐ๐ผ๐ฟ๐ฒ ๐๐ผ ๐ฒ๐ฎ๐ฐ๐ต ๐ก๐ผ๐ฑ๐ฒ that survived filtering, basing this score on the active scoring rules.
๐น Finally, the kube-scheduler assigns the Pod to the Node with the highest ranking. If there is more than ๐ผ๐ป๐ฒ ๐ป๐ผ๐ฑ๐ฒ ๐๐ถ๐๐ต ๐ฒ๐พ๐๐ฎ๐น ๐๐ฐ๐ผ๐ฟ๐ฒ๐, the kube-scheduler selects one of these at random.
๐น Static Pods in Kubernetes are a way to run pods that are ๐บ๐ฎ๐ป๐ฎ๐ด๐ฒ๐ฑ ๐ฑ๐ถ๐ฟ๐ฒ๐ฐ๐๐น๐ ๐ฏ๐ ๐๐ต๐ฒ ๐ธ๐๐ฏ๐ฒ๐น๐ฒ๐ ๐ผ๐ป ๐ฎ ๐ป๐ผ๐ฑ๐ฒ, rather than being managed by the Kubernetes control plane.
๐น Static Pods are not defined in the Kubernetes API server like regular pods but are instead created by placing pod definition files in a specific directory on a node.
๐น Each Kubernetes node has a directory, typically located at /etc/kubernetes/manifests (or) a directory specified in the Kubelet's configuration. This directory is where you place the static pod definition files.
๐น If the application pod crashes, kubelet attempts to restart it. kubelet running on the node monitors this directory for changes.
๐น All the pods that are created are managed by the API server and the scheduler schedules it based on the compute utilization of worker nodes.
๐น Manual scheduling refers to the scheduling of the pod through the YAML manifest with the keyword nodeName: node_name, which will schedule the pod in a specific node irrespective of the scheduler's availability.
Posted on July 31, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.