I'm testing Node Affinity with Taints such that the below pod will be scheduled exactly in the expected node. I have added a Label to the Node and a Taint.
Label: node=testvm
Taint: node=testvm:NoSchedule
The pod manifest looks like below
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node
operator: In
values:
- testvm
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
But when I apply it gives the below error
* spec.tolerations: Forbidden: existing toleration can not be modified except its tolerationSeconds
* spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, `spec.initContainers[*].image`, `spec.activeDeadlineSeconds`, `spec.tolerations` (only additions to existing tolerations) or `spec.terminationGracePeriodSeconds` (allow it to be set to 1 if it was previously negative)
core.PodSpec{
... // 15 identical fields
Subdomain: "",
SetHostnameAsFQDN: nil,
- Affinity: &core.Affinity{
- NodeAffinity: &core.NodeAffinity{
- RequiredDuringSchedulingIgnoredDuringExecution: &core.NodeSelector{NodeSelectorTerms: []core.NodeSelectorTerm{...}},
- },
- },
New
Warning FailedScheduling 8s (x1 over 68s) default-scheduler 0/4 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 1 node(s) had taint {nodepool: monitoring}, that the pod didn't tolerate, 1 node(s) had taint {nodepool: stage}, that the pod didn't tolerate, 1 node(s) had taint {nodepool: system}, that the pod didn't tolerate.
Normal NotTriggerScaleUp 2m23s cluster-autoscaler pod didn't trigger scale-up: 1 max node group size reached