0
0
Kubernetesdevops~20 mins

Pod priority and preemption in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pod Priority Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Pod Priority in Kubernetes

What happens when a new pod with a higher priority is scheduled but the cluster lacks free resources?

AThe new pod waits indefinitely until resources free up without affecting other pods.
BThe new pod shares resources with existing pods causing resource contention.
CThe new pod is rejected and never scheduled if resources are insufficient.
DThe new pod preempts lower priority pods to free resources and gets scheduled immediately.
Attempts:
2 left
💡 Hint

Think about how Kubernetes manages resources when priorities differ.

💻 Command Output
intermediate
2:00remaining
Output of Pod Preemption Event

What is the output of the following command when a pod is preempted due to priority?

kubectl describe pod low-priority-pod
A
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  5m    default-scheduler  Successfully assigned default/low-priority-pod
  Warning Preempted  1m    default-scheduler  Preempted by pod high-priority-pod
B
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  5m    default-scheduler  Successfully assigned default/low-priority-pod
CError from server (NotFound): pods "low-priority-pod" not found
D
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Warning Failed  1m    kubelet  Pod failed to start
Attempts:
2 left
💡 Hint

Look for event messages related to preemption in pod description.

Configuration
advanced
2:30remaining
Correct Pod Priority Class YAML

Which YAML snippet correctly defines a PodPriorityClass named high-priority with value 1000 and global default set to false?

A
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: high-priority
value: "1000"
globalDefault: false
description: "High priority pods"
B
apiVersion: v1
kind: PriorityClass
metadata:
  name: high-priority
value: 1000
globalDefault: false
description: "High priority pods"
C
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: high-priority
value: 1000
globalDefault: false
description: "High priority pods"
D
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: high-priority
value: 1000
globalDefault: true
description: "High priority pods"
Attempts:
2 left
💡 Hint

Check the correct apiVersion and data types for fields.

Troubleshoot
advanced
2:30remaining
Troubleshooting Pod Not Preempting

A high priority pod is stuck in Pending state even though lower priority pods exist. What could be a reason?

AThe lower priority pods have <code>podDisruptionBudget</code> preventing eviction.
BThe high priority pod's priority class is not defined or missing in the cluster.
CThe cluster has no nodes available at all, so preemption cannot occur.
DThe high priority pod has <code>tolerations</code> that do not match any node taints.
Attempts:
2 left
💡 Hint

Think about what can block eviction of pods even if they have lower priority.

🔀 Workflow
expert
3:00remaining
Pod Scheduling and Preemption Order

Given these events, what is the correct order of actions Kubernetes takes when scheduling a high priority pod that requires preemption?

A1,2,4,3
B1,2,3,4
C2,1,3,4
D1,3,2,4
Attempts:
2 left
💡 Hint

Think about the logical sequence from detecting resource shortage to scheduling.