Jobs, CronJobs
Scheduling Pods on Nodes
- By default k8s chooses a node and if we need to influence that we can schedule Refer Here
- Scheduling is done by one of approaches
- pods/workloads trying to choose a node
- node selector
- affinity based selections
- node trying to put a criteria for a pod to run on the node
- taints & tolerations
- pods/workloads trying to choose a node
- K8s also allow to create your own schedulers.
Pod Selecting a node by label or name
- Example of directly selecting a node
---
apiVersion: v1
kind: Pod
metadata:
name: selectnode-1
spec:
nodeName: aks-nodepool1-33085162-vmss000002
containers:
- name: web
image: nginx
resources:
requests:
cpu: 100m
memory: 10M
limits:
cpu: 500m
memory: 128M
- Node selector
---
apiVersion: v1
kind: Pod
metadata:
name: selectnode-1
spec:
nodeSelector:
env: dev
containers:
- name: web
image: nginx
resources:
requests:
cpu: 100m
memory: 10M
limits:
cpu: 500m
memory: 128M
Affinity based selection
- Refer Here for affinity
- Affinity has 3 options
- nodeAffinity
- podAffinity
- podAntiAffinity
- In affinity based selections you will have
- requiredDuringSchedulingIgnoredDuringExecution: This is hard rule pod will be schedule only when this condition is met
- preferredDuringSchedulingIgnoredDuringExecution: This is soft rule pod will be schedule preferrable on the condition, but if the condition is not met k8s will schedule the pod on best fit node.
To be continued.

