Kubernetes에서 개인 DNS와 상위 도메인 이름 서버를 설정합니다 (coredns forward)

1. CoreDNS ConfigMap 수정 및 조건부 전달 서버 구성 추가하기


모든 비집단 DNS를 특정한 도메인 이름 서버 (172.16.0.1에 있음) 를 통해 프록시와 forward를/etc/resolv가 아닌 도메인 이름 서버에 가리키도록 강제합니다.conf.
클러스터의 Consul 도메인 서버가 10.150.0.1에 있고 모든 Consul 이름에 접미사가 있는 경우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
    }

참고 도메인 이름을 도메인 이름으로 바꿉니다.custom-dns-server를 사용자 정의 DNS 서버 IP 주소로 바꿉니다.

2. 도메인 이름 확인 방법

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

좋은 웹페이지 즐겨찾기