mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Support kube-dns stubDomains in nodelocaldns
With this change, node-local-dns pods will mount the kube-dns configmap and update the Corefile with the stubDomain config.
This commit is contained in:
parent
7a7f856e22
commit
1819c2ea9b
@ -22,7 +22,29 @@ metadata:
|
|||||||
kubernetes.io/cluster-service: "true"
|
kubernetes.io/cluster-service: "true"
|
||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
---
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: kube-dns-upstream
|
||||||
|
namespace: kube-system
|
||||||
|
labels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
kubernetes.io/cluster-service: "true"
|
||||||
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
|
kubernetes.io/name: "KubeDNSUpstream"
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: dns
|
||||||
|
port: 53
|
||||||
|
protocol: UDP
|
||||||
|
targetPort: 53
|
||||||
|
- name: dns-tcp
|
||||||
|
port: 53
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 53
|
||||||
|
selector:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
@ -40,8 +62,8 @@ data:
|
|||||||
}
|
}
|
||||||
reload
|
reload
|
||||||
loop
|
loop
|
||||||
bind __PILLAR__LOCAL__DNS__
|
bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__
|
||||||
forward . __PILLAR__DNS__SERVER__ {
|
forward . __PILLAR__CLUSTER__DNS__ {
|
||||||
force_tcp
|
force_tcp
|
||||||
}
|
}
|
||||||
prometheus :9253
|
prometheus :9253
|
||||||
@ -52,8 +74,8 @@ data:
|
|||||||
cache 30
|
cache 30
|
||||||
reload
|
reload
|
||||||
loop
|
loop
|
||||||
bind __PILLAR__LOCAL__DNS__
|
bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__
|
||||||
forward . __PILLAR__DNS__SERVER__ {
|
forward . __PILLAR__CLUSTER__DNS__ {
|
||||||
force_tcp
|
force_tcp
|
||||||
}
|
}
|
||||||
prometheus :9253
|
prometheus :9253
|
||||||
@ -63,8 +85,8 @@ data:
|
|||||||
cache 30
|
cache 30
|
||||||
reload
|
reload
|
||||||
loop
|
loop
|
||||||
bind __PILLAR__LOCAL__DNS__
|
bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__
|
||||||
forward . __PILLAR__DNS__SERVER__ {
|
forward . __PILLAR__CLUSTER__DNS__ {
|
||||||
force_tcp
|
force_tcp
|
||||||
}
|
}
|
||||||
prometheus :9253
|
prometheus :9253
|
||||||
@ -74,8 +96,8 @@ data:
|
|||||||
cache 30
|
cache 30
|
||||||
reload
|
reload
|
||||||
loop
|
loop
|
||||||
bind __PILLAR__LOCAL__DNS__
|
bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__
|
||||||
forward . /etc/resolv.conf {
|
forward . __PILLAR__UPSTREAM__SERVERS__ {
|
||||||
force_tcp
|
force_tcp
|
||||||
}
|
}
|
||||||
prometheus :9253
|
prometheus :9253
|
||||||
@ -111,14 +133,12 @@ spec:
|
|||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
containers:
|
containers:
|
||||||
- name: node-cache
|
- name: node-cache
|
||||||
image: k8s.gcr.io/k8s-dns-node-cache:1.15.3
|
image: k8s.gcr.io/k8s-dns-node-cache:1.15.6
|
||||||
resources:
|
resources:
|
||||||
limits:
|
|
||||||
memory: 30Mi
|
|
||||||
requests:
|
requests:
|
||||||
cpu: 25m
|
cpu: 25m
|
||||||
memory: 5Mi
|
memory: 5Mi
|
||||||
args: [ "-localip", "__PILLAR__LOCAL__DNS__", "-conf", "/etc/coredns/Corefile" ]
|
args: [ "-localip", "__PILLAR__LOCAL__DNS__,__PILLAR__DNS__SERVER__", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
@ -144,14 +164,20 @@ spec:
|
|||||||
readOnly: false
|
readOnly: false
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
mountPath: /etc/coredns
|
mountPath: /etc/coredns
|
||||||
|
- name: kube-dns-config
|
||||||
|
mountPath: /etc/kube-dns
|
||||||
volumes:
|
volumes:
|
||||||
- name: xtables-lock
|
- name: xtables-lock
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /run/xtables.lock
|
path: /run/xtables.lock
|
||||||
type: FileOrCreate
|
type: FileOrCreate
|
||||||
|
- name: kube-dns-config
|
||||||
|
configMap:
|
||||||
|
name: kube-dns
|
||||||
|
optional: true
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
name: node-local-dns
|
name: node-local-dns
|
||||||
items:
|
items:
|
||||||
- key: Corefile
|
- key: Corefile
|
||||||
path: Corefile
|
path: Corefile.base
|
||||||
|
Loading…
Reference in New Issue
Block a user