1.安装插件CoreDNS,参考官方网站的地址:https://kubernetes.io/zh/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/

# kubeadm init phase addon coredns --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.17.0 

2.CoreDNS是模块化且可插入的DNS服务器,每个插件都为CoreDNS添加了新功能。可以通过维护Corefile(即CoreDNS配置文件)进行配置。

#以下是查看yaml文件
# kubectl get configmap -n kube-system coredns -o yaml
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
        cache 30
        loop
        reload
        loadbalance
    }
kind: ConfigMap
metadata:
  creationTimestamp: "2020-02-13T10:27:07Z"
  name: coredns
  namespace: kube-system
  resourceVersion: "689465"
  selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
  uid: 7f2a0c4a-4578-499f-a02a-7a42160831f2

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐