Service Configuration
medium

Pregunta de Service Configuration #019e3a4f

Enunciado de la Pregunta
Service Configuration
#kubernetes
#scheduler
#pod scheduling
Medio

Which component in Kubernetes is responsible to watch newly created Pods with no assigned node, and selects a node for them to run on?

A

etcd

B

kube controller-manager

C

kube proxy

D

kube scheduler

Correcto

Explicación Oficial / Explicaciones de la Comunidad

The kube-scheduler is the Kubernetes component responsible for watching newly created Pods that have no node assigned, and selecting a suitable node for them to run on. It runs as a control plane component and is typically deployed on the master node.

How it Works

The kube-scheduler continuously monitors the API server for Pods whose spec.nodeName is empty. When a new unscheduled Pod is detected, the scheduler selects an optimal node based on a set of predicates (filters) and priorities (scoring). Predicates ensure the node meets the Pod's resource requirements, such as CPU, memory, and disk, as well as constraints like node affinity, taints/tolerations, and pod anti-affinity. Priorities rank the remaining nodes to choose the best fit, considering factors like resource availability, locality, and custom scoring functions.

Why the Correct Value is Right

The kube-scheduler is the only component specifically designed for this task. It is configurable via flags like --policy-config-file for custom scheduling policies, and it can be extended with custom schedulers. The scheduler's decision is written back to the API server, updating the Pod's nodeName field.

Why the Incorrect Values are Wrong

  • etcd: This is a distributed key-value store used as Kubernetes' backing store for all cluster data. It does not perform scheduling; it only stores the state of the cluster, including Pod and node information.
  • kube-controller-manager: This runs various controllers that regulate the state of the cluster, such as the node controller, replication controller, and endpoints controller. It does not schedule Pods; it ensures the desired number of Pods are running and handles node failures.
  • kube-proxy: This is a network proxy that runs on each node, maintaining network rules for Pod-to-Pod communication and load balancing Services. It has no role in scheduling Pods to nodes.