修改coredns 新增加dns 内容 $ kubectl get cm coredns -n kube-system -o yaml apiVersion: v1 data: Corefile: | .:53 { errors health hosts /etc/coredns/Hosts { fallthrough } kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure upstream fallthrough in-addr.arpa ip6.arpa } prometheus :9153 forward . /etc/resolv.conf cache 30 loop reload loadbalance } Hosts: | 172.24.119.223 news-graphql.xy.huijitrans.com 172.24.119.223 tgbus-live.xy.huijitrans.com 172.24.119.223 tgbus-comment.xy.huijitrans.com 172.24.119.223 tgbus-user.xy.huijitrans.com 172.24.119.223 graphql.xy.huijitrans.com 172.24.119.223 tgbus-api.xy.huijitrans.com 172.24.119.101 k8s-master01.gdfsxxds.rjyun master01 172.24.119.102 k8s-master02.gdfsxxds.rjyun master02 172.24.119.103 k8s-master03.gdfsxxds.rjyun master03 172.24.119.223 k8s-node01.gdfsxxds.rjyun node01 172.24.119.224 k8s-node02.gdfsxxds.rjyun node02 172.24.119.225 k8s-node03.gdfsxxds.rjyun node03 172.24.119.226 k8s-node04.gdfsxxds.rjyun node04 172.24.119.252 k8s-harbor01 k8s-harbor01.gdfsxxds.rjyun 192.168.8.11 mysql-178-fs189 kind: ConfigMap metadata: creationTimestamp: "2019-08-20T04:48:50Z" name: coredns namespace: kube-system resourceVersion: "56953316" selfLink: /api/v1/namespaces/kube-system/configmaps/coredns uid: cd9f9802-c305-11e9-8099-b8ca3a60e5c8 2. 修改 deployment coredns kubectl edit deployment coredns -n kube-system volumes: - configMap: defaultMode: 420 items: - key: Corefile path: Corefile - key: Hosts 新增加 hosts 配置内容 path: Hosts name: coredns name: config-volume 3. coredns pod 会自动重新部署 $ kubectl get pod -n kube-system |grep dns coredns-c7b458cf-spkv7 1/1 Running 0 6m15s coredns-c7b458cf-wpjjq 1/1 Running 0 6m15s
原文地址:https://www.cnblogs.com/lixinliang/p/12217319.html
时间: 2024-10-21 03:15:14