美文网首页K8s
k8s系列 - coredns增加解析

k8s系列 - coredns增加解析

作者: Andy_1ee | 来源:发表于2021-08-11 11:21 被阅读0次

    k8s中coredns可以为全集群提供dns解析功能, 所以如果我们要手动增加dns解析, 只需在coredns中增加dns解析对即可

    1. 编辑coredns
    kubectl edit cm/coredns -n kube-system
    
    1. 内容如下
    
    # Please edit the object below. Lines beginning with a '#' will be ignored,
    # and an empty file will abort the edit. If an error occurs while saving this file will be
    # reopened with the relevant failures.
    #
    apiVersion: v1
    data:
      Corefile: |
        .:53 {
            errors
            health {
               lameduck 5s
            }
            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 {
               max_concurrent 1000
            }
            cache 30
            loop
            reload
            loadbalance
        }
    kind: ConfigMap
    metadata:
      creationTimestamp: "2021-07-15T12:08:07Z"
      name: coredns
      namespace: kube-system
      resourceVersion: "245"
      uid: 0b992b6b-9498-4d83-8f80-073ef0861cf3
    
    
    1. 增加 dns解析
    hosts {
                192.168.100.100  <dns_path>
                fallthrough
            }
    # 注意 hosts 增加与 prometheus 对其
    

    相关文章

      网友评论

        本文标题:k8s系列 - coredns增加解析

        本文链接:https://www.haomeiwen.com/subject/koxwpltx.html