Coredns 添加自定义DNS解析记录
作者:互联网
这个算是很常见的需求了,早前也踩过 dns 无法解析的坑。
在线修改 coredns 的 configmap,不用重启哦。
kubectl edit configmap coredns -n kube-system
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream /etc/resolv.conf
fallthrough in-addr.arpa ip6.arpa
}
hosts {
192.168.1.122 demo1.xx.com
192.168.1.123 demo2.xx.com
fallthrough
}
prometheus :9153
forward . /etc/resolv.conf {
prefer_udp
}
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"Corefile":".:53 {\n errors\n health\n ready\n kubernetes cluster.local in-addr.arpa ip6.arpa {\n pods insecure\n upstream /etc/resolv.conf\n fallthrough in-addr.arpa ip6.arpa\n }\n prometheus :9153\n forward . /etc/resolv.conf {\n prefer_udp\n }\n cache 30\n loop\n reload\n loadbalance\n}\n"},"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"addonmanager.kubernetes.io/mode":"EnsureExists"},"name":"coredns","namespace":"kube-system"}}
creationTimestamp: "2020-06-10T07:50:08Z"
labels:
addonmanager.kubernetes.io/mode: EnsureExists
name: coredns
namespace: kube-system
resourceVersion: "566"
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: 61c3ac0c-8aff-4632-b53a-360ac08cda74
参考:
https://www.jianshu.com/p/d421f864732f
https://coredns.io/manual/toc/
https://coredns.io/plugins/hosts/
标签:DNS,自定义,arpa,resolv,io,coredns,kubernetes,Coredns,addr 来源: https://www.cnblogs.com/keithtt/p/13204497.html