Skip to content

Commit

Permalink
Add AntiAffinity to kube-dns. kubernetes#2693
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbucher committed Jun 11, 2017
1 parent 5aa9b5f commit e2f0267
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,47 @@ spec:
scheduler.alpha.kubernetes.io/critical-pod: ''
# For 1.6, we keep the old tolerations in case of a downgrade to 1.5
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
# For 1.6, we keep the old affinity annotation in case of a downgrade to 1.5
scheduler.alpha.kubernetes.io/affinity: >
{
"podAntiAffinity": {
"preferredDuringSchedulingIgnoredDuringExecution": [
{
"weight": 100,
"podAffinityTerm": {
"labelSelector": {
"matchExpressions": [
{
"key": "k8s-addon",
"operator": "In",
"values": ["dns-controller.addons.k8s.io"]
},
{
"key": "k8s-app",
"operator": "In",
"values": ["dns-controller"]
}
]
}
}
}
]
}
}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: k8s-addon
operator: In
values: ["dns-controller.addons.k8s.io"]
- key: k8s-app
operator: In
values: ["dns-controller"]
dnsPolicy: Default # Don't use cluster DNS.
serviceAccountName: kube-dns
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,32 @@ spec:
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
scheduler.alpha.kubernetes.io/affinity: >
{
"podAntiAffinity": {
"preferredDuringSchedulingIgnoredDuringExecution": [
{
"weight": 100,
"podAffinityTerm": {
"labelSelector": {
"matchExpressions": [
{
"key": "k8s-addon",
"operator": "In",
"values": ["dns-controller.addons.k8s.io"]
},
{
"key": "k8s-app",
"operator": "In",
"values": ["dns-controller"]
}
]
}
}
}
]
}
}
spec:
containers:
- name: autoscaler
Expand Down

0 comments on commit e2f0267

Please sign in to comment.