我有以下配置映射
kubectl get configmap coredns --namespace kube-system -o yaml
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
proxy . /etc/resolv.conf
cache 30
reload
}
kind: ConfigMap
metadata:
creationTimestamp: 2018-06-29T03:48:35Z
name: coredns
namespace: kube-system
resourceVersion: "222"
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: 4c8c3b17-7b4f-11e8-aaa1-0cc47a453e30
但是我看不到上游dns服务器的来源。我最初使用kube-dns部署了此k8s集群,但在1.11发行时更新为coredns。我的上游服务器设置为192.168.1.18,但是我现在需要更改它。我已经检查了每个主机的/etc/resolv.conf,那里没有列出192.168.1.18,从这个配置图中我也看不到...但是如果我停止了192.168.1.18上的DNS,则pod停止了从外部解决。该IP地址存储在哪里?
答案 0 :(得分:0)
因此,本地dns似乎设置为coredns
/etc/resolv.conf
nameserver 127.0.0.53
如果我查看监听53的dns服务,我会明白
kubectl describe svc kube-dns --namespace kube-system
Name: kube-dns
Namespace: kube-system
Labels: k8s-app=kube-dns
kubernetes.io/cluster-service=true
kubernetes.io/name=KubeDNS
Annotations: prometheus.io/scrape=true
Selector: k8s-app=kube-dns
Type: ClusterIP
IP: 10.96.0.10
Port: dns 53/UDP
TargetPort: 53/UDP
Endpoints: 10.32.0.12:53,10.32.0.14:53
与coredns Pod相关。当输入时...包含IP地址
kubectl exec -it --namespace kube-system coredns-78fcdf6894-l4tph -- sh
/ # cd /etc
/etc # ls
TZ fstab logrotate.d os-release services
alpine-release group modprobe.d passwd shadow
apk hostname modules periodic shells
ca-certificates hosts modules-load.d profile ssl
ca-certificates.conf init.d motd profile.d sysctl.conf
conf.d inittab mtab protocols sysctl.d
coredns issue network resolv.conf udhcpd.conf
crontabs localtime opt securetty
/etc # cat resolv.conf
nameserver 192.168.1.18
search home
哦。什么是PITA