DEV Community

Ibrahim S
Ibrahim S

Posted on

Static Pods, Manual Scheduling, Labels, and Selectors โ€” Kubernetes

๐Ÿ”น 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.

Image of Timescale

๐Ÿš€ pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applicationsโ€”without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Image of Docusign

๐Ÿ› ๏ธ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more