Scheduling Flashcards
What’s the normal scheduling procedure for a pod that was just created trough default settings?
If there’s no manual nodeName within spec, the scheduler will run an algorithm to randomly select one allowed node and bind the pod to it.
What would happen if there’s no scheduler in place and you just created a pod?
The pod would be stuck in pending state.
When can you actually assign a pod manually to a node?
Before creating the pod, however its possible to reassign a running altho trough curl and binding definition.
How can we use labels, selectors and annotations in Kubernetes?
Labels are used to categorise objects, like tagging while selectors for filtering. We can then match objects together like ReplicaSet and Service do trough selector key. Annotations are a form of commenting, useful for version info, location.
What’s the deal with tains and tolerations in Kubernetes?
Taints are applied to a node and dictate what pods can be placed on them. Tolerants allow the pods to be able to match on taints according to the nodes.
As such this allowes us to control which nodes can accept which pods. But it does not guarantee which pods end up on which specific nodes since node config may differ.
Lets say you’re about to taint a node and need to evict the existing pods not tolerating the taint. Which of the effect would you use to accomplish this?
- NoSchedule
- PreferNoSchedule
- NoExecute
First use the NoExecute, then the NoSchedule.
What’s the biggest difference between tains and tolerants when compared to node selectors?
Where tains and tolerants try to match nodes with pods, node selectors will match only however no support for boleans.
How to we apply node selectors on nodes and pods?
First a key=value is applied to a node, then the pod get nodeSelector with matching label applied to it.
Node Selector and Node Affinity are very alike but with one difference, what is it?
Logical conditions such as OR, NOT.
With Node Affinity, you have three options:
- requiredDuringSchedulingIgnoredDuringExecution
- preferredDuringSchedulingIgnoredDuringExecution:
- requiredDuringSchedulingRequiredDuringExecution
How do they differ from each other?
First one states that the pod rules must match, else it’ll end up in pending state. Second one prefers matching of rules but if not then the pod might still end up in a node where its operational. Third one is evicting running pods.
Why would you use Taints & Tolerations with Node Affinity?
Taints & Tolerations match nodes and pods, however does not guarantee that they end up together as pods might be placed on nodes without taints. Node Affinity on the other hand restricts pods to only be placed on logical conditions.