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