k8s 클러스터의 kube-flannel-ds 포드에서 /etc/resolv.conf를 어떻게 구성합니까?

k8s 클러스터의 kube-flannel-ds 포드에서 /etc/resolv.conf를 어떻게 구성합니까?

저는 마스터 1명과 워커 3명이 있는 kubernetes 클러스터(베어메탈, v1.23)를 실행하고 있습니다. 포드 네트워크에 플란넬(v0.19.2)을 사용하고 있습니다.

내 syslog에 다음과 같은 오류가 표시됩니다. Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 46.38.252.230 46.38.225.230 2a03:4000:8000::fce6이 오류는 포드에서 발생합니다 kube-flannel-ds. 포드 내부에는 다음이 표시됩니다.

$ cat /etc/resolv.conf

nameserver 46.38.252.230
nameserver 46.38.225.230
nameserver 2a03:4000:0:1::e1e6
search

3줄 이상이므로 오류 메시지가 나타납니다. 하지만 이 conf 파일이 어떻게 생성되는지 모르기 때문에 어떻게 해결해야 할지 모르겠습니다.

k8s 클러스터 생성 시 다음을 수행했습니다.kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/v0.19.2/Documentation/kube-flannel.yml >> pod_network_setup.txt


업데이트

작업자 노드는 ubuntu 22.04 시스템에서 실행 중입니다.

고양이 /etc/resolv.conf

# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad
search .

해결 상태

Global
         Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: stub
Current DNS Server: 46.38.252.230
       DNS Servers: 46.38.252.230 46.38.225.230 2a03:4000:8000::fce6 2a03:4000:0:1::e1e6

Link 2 (eth0)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

Link 3 (docker0)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

답변1

dnsPolicy를 로 설정 하면 DefaultKubernetes Pod는 자신이 있는 작업자 노드에서 DNS 구성을 상속합니다.

작업자 Linux 배포판 및 기타 세부 정보에 따라 다음에서 해당 구성을 찾을 수 있습니다.

  • /etc/resolv.conf

  • /etc/dhcp/dhclient.conf

  • /etc/sysconfig/network-scripts/(Fedora, Centos 및 RHEL)

관련 정보