mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
add upstream
add pod affinity
This commit is contained in:
parent
1150de9ce6
commit
2853738a6b
@ -57,12 +57,13 @@ data:
|
|||||||
Corefile: |
|
Corefile: |
|
||||||
.:53 {
|
.:53 {
|
||||||
errors
|
errors
|
||||||
log
|
|
||||||
health
|
health
|
||||||
kubernetes __PILLAR__DNS__DOMAIN__ __PILLAR__CLUSTER_CIDR__ {
|
kubernetes __PILLAR__DNS__DOMAIN__ __PILLAR__CLUSTER_CIDR__ {
|
||||||
pods insecure
|
pods insecure
|
||||||
|
upstream /etc/resolv.conf
|
||||||
|
fallthrough in-addr.arpa ip6.arpa
|
||||||
}
|
}
|
||||||
prometheus
|
prometheus :9153
|
||||||
proxy . /etc/resolv.conf
|
proxy . /etc/resolv.conf
|
||||||
cache 30
|
cache 30
|
||||||
}
|
}
|
||||||
@ -78,7 +79,11 @@ metadata:
|
|||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 2
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: coredns
|
k8s-app: coredns
|
||||||
@ -93,9 +98,21 @@ spec:
|
|||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
- key: "CriticalAddonsOnly"
|
- key: "CriticalAddonsOnly"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: k8s-app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- coredns
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
containers:
|
containers:
|
||||||
- name: coredns
|
- name: coredns
|
||||||
image: coredns/coredns:1.0.1
|
image: coredns/coredns:1.0.4
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
@ -114,9 +131,6 @@ spec:
|
|||||||
- containerPort: 53
|
- containerPort: 53
|
||||||
name: dns-tcp
|
name: dns-tcp
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 9153
|
|
||||||
name: metrics
|
|
||||||
protocol: TCP
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
@ -156,6 +170,3 @@ spec:
|
|||||||
- name: dns-tcp
|
- name: dns-tcp
|
||||||
port: 53
|
port: 53
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- name: metrics
|
|
||||||
port: 9153
|
|
||||||
protocol: TCP
|
|
||||||
|
@ -57,12 +57,13 @@ data:
|
|||||||
Corefile: |
|
Corefile: |
|
||||||
.:53 {
|
.:53 {
|
||||||
errors
|
errors
|
||||||
log
|
|
||||||
health
|
health
|
||||||
kubernetes {{ pillar['dns_domain'] }} {{ pillar['service_cluster_ip_range'] }} {
|
kubernetes {{ pillar['dns_domain'] }} {{ pillar['service_cluster_ip_range'] }} {
|
||||||
pods insecure
|
pods insecure
|
||||||
|
upstream /etc/resolv.conf
|
||||||
|
fallthrough in-addr.arpa ip6.arpa
|
||||||
}
|
}
|
||||||
prometheus
|
prometheus :9153
|
||||||
proxy . /etc/resolv.conf
|
proxy . /etc/resolv.conf
|
||||||
cache 30
|
cache 30
|
||||||
}
|
}
|
||||||
@ -78,7 +79,11 @@ metadata:
|
|||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 2
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: coredns
|
k8s-app: coredns
|
||||||
@ -93,9 +98,21 @@ spec:
|
|||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
- key: "CriticalAddonsOnly"
|
- key: "CriticalAddonsOnly"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: k8s-app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- coredns
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
containers:
|
containers:
|
||||||
- name: coredns
|
- name: coredns
|
||||||
image: coredns/coredns:1.0.1
|
image: coredns/coredns:1.0.4
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
@ -114,9 +131,6 @@ spec:
|
|||||||
- containerPort: 53
|
- containerPort: 53
|
||||||
name: dns-tcp
|
name: dns-tcp
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 9153
|
|
||||||
name: metrics
|
|
||||||
protocol: TCP
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
@ -156,6 +170,3 @@ spec:
|
|||||||
- name: dns-tcp
|
- name: dns-tcp
|
||||||
port: 53
|
port: 53
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- name: metrics
|
|
||||||
port: 9153
|
|
||||||
protocol: TCP
|
|
||||||
|
@ -57,12 +57,13 @@ data:
|
|||||||
Corefile: |
|
Corefile: |
|
||||||
.:53 {
|
.:53 {
|
||||||
errors
|
errors
|
||||||
log
|
|
||||||
health
|
health
|
||||||
kubernetes $DNS_DOMAIN $SERVICE_CLUSTER_IP_RANGE {
|
kubernetes $DNS_DOMAIN $SERVICE_CLUSTER_IP_RANGE {
|
||||||
pods insecure
|
pods insecure
|
||||||
|
upstream /etc/resolv.conf
|
||||||
|
fallthrough in-addr.arpa ip6.arpa
|
||||||
}
|
}
|
||||||
prometheus
|
prometheus :9153
|
||||||
proxy . /etc/resolv.conf
|
proxy . /etc/resolv.conf
|
||||||
cache 30
|
cache 30
|
||||||
}
|
}
|
||||||
@ -78,7 +79,11 @@ metadata:
|
|||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 2
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: coredns
|
k8s-app: coredns
|
||||||
@ -93,9 +98,21 @@ spec:
|
|||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
- key: "CriticalAddonsOnly"
|
- key: "CriticalAddonsOnly"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: k8s-app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- coredns
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
containers:
|
containers:
|
||||||
- name: coredns
|
- name: coredns
|
||||||
image: coredns/coredns:1.0.1
|
image: coredns/coredns:1.0.4
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
@ -114,9 +131,6 @@ spec:
|
|||||||
- containerPort: 53
|
- containerPort: 53
|
||||||
name: dns-tcp
|
name: dns-tcp
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 9153
|
|
||||||
name: metrics
|
|
||||||
protocol: TCP
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
@ -156,6 +170,3 @@ spec:
|
|||||||
- name: dns-tcp
|
- name: dns-tcp
|
||||||
port: 53
|
port: 53
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- name: metrics
|
|
||||||
port: 9153
|
|
||||||
protocol: TCP
|
|
||||||
|
@ -224,7 +224,11 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
k8s-app: kube-dns
|
k8s-app: kube-dns
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 2
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: kube-dns
|
k8s-app: kube-dns
|
||||||
@ -239,6 +243,18 @@ spec:
|
|||||||
operator: Exists
|
operator: Exists
|
||||||
- key: {{ .MasterTaintKey }}
|
- key: {{ .MasterTaintKey }}
|
||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: k8s-app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- coredns
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
containers:
|
containers:
|
||||||
- name: coredns
|
- name: coredns
|
||||||
image: coredns/coredns:{{ .Version }}
|
image: coredns/coredns:{{ .Version }}
|
||||||
@ -260,9 +276,6 @@ spec:
|
|||||||
- containerPort: 53
|
- containerPort: 53
|
||||||
name: dns-tcp
|
name: dns-tcp
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 9153
|
|
||||||
name: metrics
|
|
||||||
protocol: TCP
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
@ -293,12 +306,13 @@ data:
|
|||||||
Corefile: |
|
Corefile: |
|
||||||
.:53 {
|
.:53 {
|
||||||
errors
|
errors
|
||||||
log
|
|
||||||
health
|
health
|
||||||
kubernetes {{ .DNSDomain }} {{ .ServiceCIDR }} {
|
kubernetes {{ .DNSDomain }} {{ .ServiceCIDR }} {
|
||||||
pods insecure
|
pods insecure
|
||||||
|
upstream /etc/resolv.conf
|
||||||
|
fallthrough in-addr.arpa ip6.arpa
|
||||||
}
|
}
|
||||||
prometheus
|
prometheus :9153
|
||||||
proxy . /etc/resolv.conf
|
proxy . /etc/resolv.conf
|
||||||
cache 30
|
cache 30
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,13 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
kubeDNSv190AndAboveVersion = "1.14.8"
|
kubeDNSv190AndAboveVersion = "1.14.8"
|
||||||
coreDNSVersion = "1.0.1"
|
coreDNSVersion = "1.0.4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetDNSVersion returns the right kube-dns version for a specific k8s version
|
// GetDNSVersion returns the right kube-dns version for a specific k8s version
|
||||||
func GetDNSVersion(kubeVersion *version.Version, dns string) string {
|
func GetDNSVersion(kubeVersion *version.Version, dns string) string {
|
||||||
// v1.9.0+ uses kube-dns 1.14.8
|
// v1.9.0+ uses kube-dns 1.14.8
|
||||||
// v1.9.0+ uses CoreDNS 1.0.1 if feature gate "CoreDNS" is enabled.
|
// v1.9.0+ uses CoreDNS 1.0.4 if feature gate "CoreDNS" is enabled.
|
||||||
|
|
||||||
// In the future when the version is bumped at HEAD; add conditional logic to return the right versions
|
// In the future when the version is bumped at HEAD; add conditional logic to return the right versions
|
||||||
// Also, the version might be bumped for different k8s releases on the same branch
|
// Also, the version might be bumped for different k8s releases on the same branch
|
||||||
|
Loading…
Reference in New Issue
Block a user