プライベートDNS設定Kubernetes上流およびドメインネームサーバ(前方coredns)

CoreDNS ConfigMap条件付き転送サーバの設定を変更し、追加するには1

前方に強制的にすべての非クラスタ化されたDNSルックアップ(172.16.0.1を設置)、特定のドメインネームサーバを経由して、プロキシ、代わりに/etc/resolv.confの、ドメインネームサーバをポイントします。

領事ドメインサーバクラスタは、10.150.0.1配置されている場合領事とサフィックス.consul.local持つすべての名前

$ kubectl -n kube-system edit configmap coredns

出力は次のよう:

apiVersion: v1
kind: ConfigMap
metadata:
  annotations:
  labels:
    eks.amazonaws.com/component: coredns
    k8s-app: kube-dns
  name: coredns
  namespace: kube-system
data:
  Corefile: |
    .:53 {
        errors
        health
        kubernetes cluster.local in-addr.arpa ip6.arpa {
          pods insecure
          upstream 172.16.0.1
          fallthrough in-addr.arpa ip6.arpa
        }
        prometheus :9153
        proxy . 172.16.0.1
        cache 30
        loop
        reload
        loadbalance
    }
    domain-name:53 {
        errors 
        cache 30
        forward . custom-dns-server
        reload
    }
     consul.local:53 {
        errors
        cache 30
        proxy . 10.150.0.1
    }

注:ドメイン名としてドメイン名を置き換えます。カスタムDNSサーバは、カスタムDNSサーバーのIPアドレスに置き換えています。

DNS方式いることを確認してください2

$ kubectl run busybox --restart=Never --image=busybox -- sleep 3600
$ kubectl exec busybox -- nslookup domain-name

おすすめ

転載: blog.51cto.com/foxhound/2483880