Configure anti-affinity for coredns pods
There is no supported way to do this to configure the coredns pod for anti-affinity. See https://github.com/kubernetes/kubeadm/issues/1416 For now we will set this with a patch in the kubernetes manifest. Change-Id: I3c83cee9d3209b223fd2c2e1149a85205e3c9b15 Story: 2004520 Task: 29726 Signed-off-by: David Sullivan <david.sullivan@windriver.com>
This commit is contained in:
parent
57124b49dc
commit
91d7422bd9
|
@ -1,2 +1,2 @@
|
|||
SRC_DIR="src"
|
||||
TIS_PATCH_VER=80
|
||||
TIS_PATCH_VER=81
|
||||
|
|
|
@ -151,6 +151,11 @@ class platform::kubernetes::master::init
|
|||
logoutput => true,
|
||||
}
|
||||
|
||||
-> exec { 'Use anti-affinity for coredns pods':
|
||||
command => 'kubectl --kubeconfig=/etc/kubernetes/admin.conf -n kube-system patch deployment coredns -p \'{"spec":{"template":{"spec":{"affinity":{"podAntiAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"labelSelector":{"matchExpressions":[{"key":"k8s-app","operator":"In","values":["kube-dns"]}]},"topologyKey":"kubernetes.io/hostname"}]}}}}}}\'', # lint:ignore:140chars
|
||||
logoutput => true,
|
||||
}
|
||||
|
||||
# Remove the taint from the master node
|
||||
-> exec { 'remove taint from master node':
|
||||
command => "kubectl --kubeconfig=/etc/kubernetes/admin.conf taint node ${::platform::params::hostname} node-role.kubernetes.io/master- || true", # lint:ignore:140chars
|
||||
|
@ -257,6 +262,11 @@ class platform::kubernetes::master::init
|
|||
logoutput => true,
|
||||
}
|
||||
|
||||
-> exec { 'Use anti-affinity for coredns pods':
|
||||
command => 'kubectl --kubeconfig=/etc/kubernetes/admin.conf -n kube-system patch deployment coredns -p \'{"spec":{"template":{"spec":{"affinity":{"podAntiAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"labelSelector":{"matchExpressions":[{"key":"k8s-app","operator":"In","values":["kube-dns"]}]},"topologyKey":"kubernetes.io/hostname"}]}}}}}}\'', # lint:ignore:140chars
|
||||
logoutput => true,
|
||||
}
|
||||
|
||||
# Remove the taint from the master node
|
||||
-> exec { 'remove taint from master node':
|
||||
command => "kubectl --kubeconfig=/etc/kubernetes/admin.conf taint node ${::platform::params::hostname} node-role.kubernetes.io/master- || true", # lint:ignore:140chars
|
||||
|
|
Loading…
Reference in New Issue