A DevOps team wants to ensure that a critical web application pod runs on a dedicated set of nodes with SSDs. Which Kubernetes feature should they use to achieve this?
Trap 1: Pod priority and preemption
Pod priority and preemption are mechanisms that influence the scheduling order of pods and allow higher-priority pods to evict lower-priority pods from nodes if resources are scarce. While critical for workload management and ensuring important applications run, these features do not provide a direct mechanism for a pod to express a preference or requirement for specific *types* of nodes based on labels or attributes. They manage *when* a pod gets scheduled, not *where* it specifically targets.
Trap 2: Taints and tolerations
Taints are applied to nodes to repel pods, preventing them from scheduling onto that node unless the pod has a corresponding toleration. This mechanism is primarily used for ensuring nodes are reserved for specific workloads or to keep misbehaving pods off certain nodes. However, taints and tolerations do not actively *attract* pods to particular nodes; they only allow pods to *tolerate* an existing exclusion, making them unsuitable for expressing a preference to land on a specific node type.
Trap 3: Resource quotas
Resource quotas are a mechanism to limit the aggregate resource consumption (like CPU, memory, or number of pods) within a specific Kubernetes namespace. They ensure fair usage among teams or projects and prevent any single namespace from consuming all available cluster resources. However, resource quotas do not provide any functionality to influence *which specific nodes* a pod will be scheduled onto; they only enforce limits on *how much* can be consumed within a defined scope, irrespective of node characteristics.
- A
Pod priority and preemption
Why wrong: Pod priority and preemption are mechanisms that influence the scheduling order of pods and allow higher-priority pods to evict lower-priority pods from nodes if resources are scarce. While critical for workload management and ensuring important applications run, these features do not provide a direct mechanism for a pod to express a preference or requirement for specific *types* of nodes based on labels or attributes. They manage *when* a pod gets scheduled, not *where* it specifically targets.
- B
Taints and tolerations
Why wrong: Taints are applied to nodes to repel pods, preventing them from scheduling onto that node unless the pod has a corresponding toleration. This mechanism is primarily used for ensuring nodes are reserved for specific workloads or to keep misbehaving pods off certain nodes. However, taints and tolerations do not actively *attract* pods to particular nodes; they only allow pods to *tolerate* an existing exclusion, making them unsuitable for expressing a preference to land on a specific node type.
- C
Node affinity
Node affinity is a powerful feature that allows pods to specify rules for which nodes they are eligible to be scheduled on, based on labels attached to the nodes. It supports both `requiredDuringSchedulingIgnoredDuringExecution` rules, which are hard requirements, and `preferredDuringSchedulingIgnoredDuringExecution` rules, which are soft preferences. This enables a devops team to precisely direct critical applications to specific hardware, zones, or other labeled node characteristics, ensuring optimal placement and performance.
- D
Resource quotas
Why wrong: Resource quotas are a mechanism to limit the aggregate resource consumption (like CPU, memory, or number of pods) within a specific Kubernetes namespace. They ensure fair usage among teams or projects and prevent any single namespace from consuming all available cluster resources. However, resource quotas do not provide any functionality to influence *which specific nodes* a pod will be scheduled onto; they only enforce limits on *how much* can be consumed within a defined scope, irrespective of node characteristics.