k8s 使用coredns 自定义hosts 解析
修改coredns cm
kubectl edit cm coredns -n kube-systemapiVersion: v1
data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods verified
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . 10.8.255.1 10.8.255.2 8.8.8.8 {
max_concurrent 1000
}
autopath @kubernetes
cache 30
loop
reload
loadbalance
# 自定义解析内网解析
hosts {
172.16.187.71 liujinye.example.com
fallthrough
}
}
kind: ConfigMap
metadata:
name: coredns
namespace: kube-systemcoredns 服务会自动加载配置
如果部署了node-local-dns, 同时也要修改 node-local-dns cm
node-local-dns服务会自动加载配置
Last updated