k8s系列 - coredns增加解析
2021-08-11 本文已影响0人
Andy_1ee
k8s中coredns可以为全集群提供dns解析功能, 所以如果我们要手动增加dns解析, 只需在coredns中增加dns解析对即可
1. 编辑coredns
kubectl edit cm/coredns -n kube-system
- 内容如下
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
Corefile: |
.:53 {
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 . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
metadata:
creationTimestamp: "2021-07-15T12:08:07Z"
name: coredns
namespace: kube-system
resourceVersion: "245"
uid: 0b992b6b-9498-4d83-8f80-073ef0861cf3
- 增加 dns解析
hosts {
192.168.100.100 <dns_path>
fallthrough
}
# 注意 hosts 增加与 prometheus 对其