0
0
Kubernetesdevops~10 mins

Pod priority and preemption in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the priority class name for a pod.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: example-pod
spec:
  priorityClassName: [1]
  containers:
  - name: nginx
    image: nginx
Drag options to blanks, or click blank then click option'
Ahigh-priority
Blow-priority
Cmedium-priority
Dno-priority
Attempts:
3 left
💡 Hint
Common Mistakes
Using a priority class name that does not exist in the cluster.
2fill in blank
medium

Complete the command to create a priority class with high priority.

Kubernetes
kubectl create priorityclass [1] --value=1000 --description="High priority class"
Drag options to blanks, or click blank then click option'
Amedium-priority
Blow-priority
Cdefault-priority
Dhigh-priority
Attempts:
3 left
💡 Hint
Common Mistakes
Using a priority class name that does not match the value.
3fill in blank
hard

Fix the error in the pod spec to enable preemption by setting the correct field.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: preemptible-pod
spec:
  priorityClassName: high-priority
  [1]: "PreemptLowerPriority"
  containers:
  - name: busybox
    image: busybox
    command: ["sleep", "3600"]
Drag options to blanks, or click blank then click option'
AenablePreemption
BpreemptionPolicy
Cpreemptible
DallowPreemption
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent fields like 'enablePreemption' or 'allowPreemption'.
4fill in blank
hard

Fill both blanks to create a priority class YAML with correct apiVersion and kind.

Kubernetes
apiVersion: [1]
kind: [2]
metadata:
  name: custom-priority
value: 500
globalDefault: false
description: "Custom priority class"
Drag options to blanks, or click blank then click option'
Ascheduling.k8s.io/v1
Bv1
CPriorityClass
DPodPriority
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v1' as apiVersion or 'PodPriority' as kind.
5fill in blank
hard

Fill in the blanks to write a pod spec that uses a priority class and disables preemption.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: no-preempt-pod
spec:
  priorityClassName: [1]
  preemptionPolicy: [2]
  containers:
  - name: app
    image: nginx
    command: ["nginx", "-g", "daemon off;"]
Drag options to blanks, or click blank then click option'
Ahigh-priority
BNever
Creplicas
Dpriority
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'replicas' in pod spec (only for deployments).
Setting preemptionPolicy to wrong values.