Complete the code to set the priority class name for a pod.
apiVersion: v1
kind: Pod
metadata:
name: example-pod
spec:
priorityClassName: [1]
containers:
- name: nginx
image: nginxThe priorityClassName field assigns the pod's priority. "medium-priority" is a common default priority class.
Complete the command to create a priority class with high priority.
kubectl create priorityclass [1] --value=1000 --description="High priority class"
The command creates a priority class named "high-priority" with a high value of 1000.
Fix the error in the pod spec to enable preemption by setting the correct field.
apiVersion: v1 kind: Pod metadata: name: preemptible-pod spec: priorityClassName: high-priority [1]: "PreemptLowerPriority" containers: - name: busybox image: busybox command: ["sleep", "3600"]
The correct field to control preemption behavior is preemptionPolicy. Setting it to "PreemptLowerPriority" enables preemption.
Fill both blanks to create a priority class YAML with correct apiVersion and kind.
apiVersion: [1] kind: [2] metadata: name: custom-priority value: 500 globalDefault: false description: "Custom priority class"
The apiVersion for priority classes is 'scheduling.k8s.io/v1' and the kind is 'PriorityClass'.
Fill in the blanks to write a pod spec that uses a priority class and disables preemption.
apiVersion: v1 kind: Pod metadata: name: no-preempt-pod spec: priorityClassName: [1] preemptionPolicy: [2] containers: - name: app image: nginx command: ["nginx", "-g", "daemon off;"]
The pod uses the 'high-priority' class, sets preemptionPolicy to 'Never' to disable preemption.