kubeasz/manifests/kubedns/readme.md

1.5 KiB
Raw Blame History

kubedns

部署文件

  1. kubedns-cm
  2. kubedns-controller
  3. kubedns-sa
  4. kubedns-svc

pod继承node的dns解析

When running a pod, kubelet will prepend the cluster DNS server and search paths to the nodes own DNS settings. If the node is able to resolve DNS names specific to the larger environment, pods should be able to, also. See “Known issues” below for a caveat.

If you dont want this, or if you want a different DNS config for pods, you can use the kubelets --resolv-conf flag. Setting it to “” means that pods will not inherit DNS. Setting it to a valid file path means that kubelet will use this file instead of /etc/resolv.conf for DNS inheritance.

configmap配置私有dns服务器和上游dns服务器(未实验)

apiVersion: v1
kind: ConfigMap
metadata:
  name: kube-dns
  namespace: kube-system
data:
  stubDomains: |
    {“acme.local”: [“1.2.3.4”]}
  upstreamNameservers: |
    [“8.8.8.8”, “8.8.4.4”]

使用上述特定配置查询请求首先会被发送到kube-dns的DNS缓存层(Dnsmasq 服务器)。Dnsmasq服务器会先检查请求的后缀带有集群后缀例如”.cluster.local”的请求会被发往kube-dns拥有存根域后缀的名称例如”.acme.local”将会被发送到配置的私有DNS服务器[“1.2.3.4”]。最后不满足任何这些后缀的请求将会被发送到上游DNS [“8.8.8.8”, “8.8.4.4”]里。