修改coredns configmap

$ kubectl edit cm -n kube-system coredns
apiVersion: v1
data:
  Corefile: |
    .:53 {
        errors
        health {
           lameduck 5s
        }
        hosts {
          192.168.99.181 k8s.lvzhenjiang.com
          fallthrough
        }

        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
           pods insecure
           fallthrough in-addr.arpa ip6.arpa
           ttl 30
        }
        prometheus :9153
        forward . /etc/resolv.conf
        cache 30
        loop
        reload
        loadbalance
    }
kind: ConfigMap
metadata:
  name: coredns
  namespace: kube-system

重启coredns服务后,进行测试!

$ k exec busybox-86dbf5b9d8-tx8j8 -- ping k8s.lvzhenjiang.com
PING k8s.lvzhenjiang.com (192.168.99.181): 56 data bytes
64 bytes from 192.168.99.181: seq=0 ttl=63 time=0.536 ms
64 bytes from 192.168.99.181: seq=1 ttl=63 time=0.690 ms
64 bytes from 192.168.99.181: seq=2 ttl=63 time=2.023 ms
64 bytes from 192.168.99.181: seq=3 ttl=63 time=1.240 ms

相关文章:

  • 2021-10-17
  • 2021-12-04
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-11-18
猜你喜欢
  • 2021-09-14
  • 2021-10-19
  • 2021-12-21
  • 2021-07-24
  • 2021-07-02
相关资源
相似解决方案