编辑coredns的配置文件

1
kubectl edit configmap coredns -n kube-system

增加解析

1
2
3
4
hosts {
127.0.0.1 nacos.com
fallthrough
}

以下为示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: afe82210-48ab-4e74-a190-7d401a8af49a
resourceVersion: '240420099'
creationTimestamp: '2022-09-29T03:44:33Z'
annotations:
forward_config: ''
data:
Corefile: |-
.:53 {
errors
health
ready
hosts {
127.0.0.1 nacos.com
fallthrough
}
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
log . {
class all
}
cache 30
loop
reload
loadbalance
forward . /etc/resolv.conf
}