0
0
Kubernetesdevops~20 mins

Priority classes for critical workloads in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Priority Class Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding PriorityClass purpose

What is the main purpose of defining a PriorityClass in Kubernetes?

ATo configure persistent storage classes for pods
BTo assign a priority value to pods that influences scheduling and eviction order
CTo specify resource limits like CPU and memory for pods
DTo define network policies for pod communication
Attempts:
2 left
💡 Hint

Think about how Kubernetes decides which pods to keep or evict under resource pressure.

💻 Command Output
intermediate
1:30remaining
Output of kubectl get priorityclass

What is the output of the command kubectl get priorityclass if you have two priority classes named high-priority with value 1000 and low-priority with value 100?

A
NAME           VALUE   GLOBAL-DEFAULT   DESCRIPTION
high-priority  1000    false            High priority class
low-priority   100     false            Low priority class
B
NAME           VALUE   GLOBAL-DEFAULT   DESCRIPTION
high-priority  100     false            High priority class
low-priority   1000    false            Low priority class
C
NAME           VALUE   GLOBAL-DEFAULT   DESCRIPTION
low-priority   100     false            Low priority class
high-priority  1000    false            High priority class
DError: priorityclass not found
Attempts:
2 left
💡 Hint

Check the order and values of priority classes as listed by kubectl.

Configuration
advanced
2:00remaining
Correct PriorityClass YAML for critical workload

Which YAML snippet correctly defines a PriorityClass named critical with a value of 100000 and sets it as the global default?

A
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: critical
value: 100000
globalDefault: false
description: "Critical priority class"
B
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: critical
spec:
  value: 100000
globalDefault: true
description: "Critical priority class"
C
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: critical
value: "100000"
globalDefault: true
description: "Critical priority class"
D
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: critical
value: 100000
globalDefault: true
description: "Critical priority class"
Attempts:
2 left
💡 Hint

Remember that value is a top-level field, not under spec, and globalDefault must be true to set default.

Troubleshoot
advanced
1:30remaining
Pod scheduling failure due to PriorityClass

A pod with PriorityClass critical is stuck in Pending state. The cluster has resource pressure and other pods with lower priority are running. What is the most likely cause?

AThe pod's PriorityClass value is lower than other pods running
BThe pod's container image is missing
CThe PriorityClass <code>critical</code> is not defined in the cluster
DThe pod has resource requests higher than node capacity
Attempts:
2 left
💡 Hint

Check if the PriorityClass exists and is spelled correctly.

Best Practice
expert
2:00remaining
Choosing PriorityClass values for critical workloads

When assigning PriorityClass values for critical workloads, which practice is best to ensure proper scheduling and eviction behavior?

AAssign very high values (e.g., 1000000) to critical workloads and low values (e.g., 10) to others, ensuring clear priority separation
BUse the same PriorityClass value for all workloads to avoid scheduling conflicts
CAssign random values to PriorityClass to distribute scheduling evenly
DSet all PriorityClass values to zero and rely on resource requests for scheduling
Attempts:
2 left
💡 Hint

Think about how Kubernetes uses priority values to decide which pods to evict first.