Scheduling Flashcards
How do you assign a pod to a node?
Define the nodeName configuration in the spec section of the pod manifest.
How do you assign a node to an existing pod?
You convert a YAML Binding manifest to JSON and then POST to the API. eg.
apiVersion: v1
kind: Binding
metadata:
name: nginx
target:
apiVersion: v1
kind: Node
name: node02
How do you get pods by specifying a label?
k get pods – selector <label>=<label_value></label_value></label>
What is the command for getting all objects in env=prod
k get all –selector=env=prod
What is the command to identify the POD which is part of the prod environment, the finance BU and of frontend tier?
k get pod –selector=env=prod,bu=finance,tier=frontend
What sets restrictions on what pods can be scheduled on a node?
Taints and tolerations
What is the command to taint a node?
k taint nodes <node_name> <key>=<value>:<taint></taint></value></key></node_name>
Taint can be one of the following:
- NoSchedule
- PreferNoSchedule
- NoExecute
What are the three types of taints?
- NoSchedule
- PreferNoSchedule
- NoExecute
How do you define a toleration?
Inside a manifest’s spec section you define:
spec:
…
tolerations:
- key: “<key_name>"
operator: "Equal"
value: "<key_value>"
effect: "<taint_match>"</taint_match></key_value></key_name>
What is the command to label a node?
k label nodes <node_name> <label_key>=<label_value></label_value></label_key></node_name>
How do you define a nodeSelector for a pod?
Inside a manifest’s spec section you define:
spec:
…
nodeSelector:
size: <size></size>
Where size = label key value pair
What are the types of node affinity?
Available
requiredDuringSchedulingIgnoredDuringExecution
preferredDuringSchedulingIgnoredDuringExecution
Planned
requiredDuringSchedulingRequiredDuringExecution
What ensures that one pod is always present on all nodes in a cluster?
Daemon Sets
What kind of manifest is almost identical to the ReplicaSet or Deployment definition?
DaemonSet
How does the kubelet create a static pod?
By placing a manifest in the pod-manifest-path directory
Can multiple copies of a scheduler running at the same time?
No. The leaderElection section of a manifest can define what scheduler is the leader.
How do you define what scheduler should be used by a pod?
spec:
…
schedulerName: <scheduler_name></scheduler_name>
What happens if you create a pod that defines using a scheduler that is not properly configured?
The pod will remain in a pending state
How do you know what scheduler picked up scheduling a pod?
k get events -o wide
How do you create seperate profiles for each scheduler using the same binary?
Define the schdulerName under the profiles section. eg.
profiles:
- schedulerName: my-scheduler-2
- schedulerName: my-scheduler-3
- schedulerName: my-scheduler-4
How do you disable or enable plugins for schedulers?
profiles:
- schedulerName: my-scheduler-2
plugins:
score:
disabled:
- name: TaintToleration
enabled:
- name: MyCustomPluginA
- name: MyCustomPluginB
- schedulerName: my-scheduler-3
plugins:
prescore:
disabled:
- name: ‘’
score:
enabled:
- name: ‘’
- schedulerName: my-scheduler-4
How do you define a priority class?
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
value: 1000000
globalDefault: false
description: “This should be used to XYZ service pods only”
How do you define a priority class on a pod manifest
Add the priorityClassName: <priority_name>
to the spec section. eg.
spec:
priorityClassName: <priority_name></priority_name>