K8S 使用的 DNS 是 Core DNS,可以在这里添加新的域名、IP 1、获取code的cm
kubectl get cm -n kube-system
NAME DATA AGE
coredns 2 33d
2、修改coredns,添加域名解析
kubectl edit cm coredns -n kube-system
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
hosts {
172.19.3.37 www.xxx.com # 你的ip 和域名
fallthrough
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
reload
loadbalance
}