Scheduler takes care of placing pods on nodes to consume cluster resources in reasonable way. But you can control how the scheduler does that by using labesls and selectors.
For example to:
nodeSelector
or nodeAffinity
)podAffinity
)podAntiAffinity
)Example:
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
nodeSelector:
size: large
Taints: features of Nodes allowing nodes to repel pods
kubectl taint nodes node1 key1=value1:NoSchedule
(taint effect is NoSchedule
, so no pod will be scheduled on node1 unless it has a toleration that matches key and label)
kubectl taint nodes node1 key1=value1:NoSchedule-
Tolerations: allow specific pod to be scheduled on a node despite of its taint