背景
公司访问的域名突然解析有问题了,需要修改nameserver,或者固定下hosts
操作
- 参考以下配置修改 coredns 的configmap (我这里是 k8s的 dashboard 修改的 地址是 https://{{dashboard的ip}}/#/configmap/kube-system/coredns?namespace=kube-system )
kind: ConfigMap
apiVersion: v1
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
hosts {
10.123.12.123 bj-dt-k8s-vip1 # 这里是固定host
fallthrough
}
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . 119.29.29.29 114.114.114.114 #这里是指定nameserver
cache 30
loop
reload
loadbalance
}
- 重启 coredns 即可 (我这里是直接缩容副本为0,再里面改回2 )
参考文档
coredns官网:https://coredns.io/plugins/forward/
标签:kube,arpa,system,修改,dns,coredns,coreDNS,pod,k8s From: https://www.cnblogs.com/x602/p/16798243.html