kubedns & kubedns-autoscaler: Stick to master nodes. (#2909)
* kubedns & kubedns-autoscaler: Stick to master nodes. - Tolerate only master nodes and not any NoSchedule taint - Pods are on different nodes - Pods are required to be on a master node. * kubedns: use soft nodeAffinity. Prefer to be on a master node, don't require. * coredns: Stick to (different) master nodes. - Pods are on different nodes - Pods are preferred to be on a master node.
This commit is contained in:
parent
001cae5894
commit
e3dcd96301
3 changed files with 53 additions and 3 deletions
|
@ -34,6 +34,22 @@ spec:
|
||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
- key: "CriticalAddonsOnly"
|
- key: "CriticalAddonsOnly"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- topologyKey: "kubernetes.io/hostname"
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: coredns{{ coredns_ordinal_suffix | default('') }}
|
||||||
|
nodeAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
preference:
|
||||||
|
matchExpressions:
|
||||||
|
- key: node-role.kubernetes.io/master
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- "true"
|
||||||
containers:
|
containers:
|
||||||
- name: coredns
|
- name: coredns
|
||||||
image: "{{ coredns_image_repo }}:{{ coredns_image_tag }}"
|
image: "{{ coredns_image_repo }}:{{ coredns_image_tag }}"
|
||||||
|
|
|
@ -30,7 +30,24 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
tolerations:
|
tolerations:
|
||||||
- effect: NoSchedule
|
- effect: NoSchedule
|
||||||
operator: Exists
|
operator: Equal
|
||||||
|
key: node-role.kubernetes.io/master
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- topologyKey: "kubernetes.io/hostname"
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kubedns-autoscaler
|
||||||
|
nodeAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
preference:
|
||||||
|
matchExpressions:
|
||||||
|
- key: node-role.kubernetes.io/master
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- "true"
|
||||||
containers:
|
containers:
|
||||||
- name: autoscaler
|
- name: autoscaler
|
||||||
image: "{{ kubednsautoscaler_image_repo }}:{{ kubednsautoscaler_image_tag }}"
|
image: "{{ kubednsautoscaler_image_repo }}:{{ kubednsautoscaler_image_tag }}"
|
||||||
|
|
|
@ -30,8 +30,25 @@ spec:
|
||||||
tolerations:
|
tolerations:
|
||||||
- key: "CriticalAddonsOnly"
|
- key: "CriticalAddonsOnly"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
- effect: NoSchedule
|
- effect: "NoSchedule"
|
||||||
operator: Exists
|
operator: "Equal"
|
||||||
|
key: "node-role.kubernetes.io/master"
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- topologyKey: "kubernetes.io/hostname"
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
nodeAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
preference:
|
||||||
|
matchExpressions:
|
||||||
|
- key: node-role.kubernetes.io/master
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- "true"
|
||||||
volumes:
|
volumes:
|
||||||
- name: kube-dns-config
|
- name: kube-dns-config
|
||||||
configMap:
|
configMap:
|
||||||
|
|
Loading…
Reference in a new issue