Set the Domain's record to the CoreDNS
這兩天在處理 DNS 的問題, 看到可以直接在 CoreDNS 中塞 record. 這邊做個紀錄
Kubernetes 官方文件 dns custom nemeservers 有寫到配置方式
多配置 DNS Server
1kubectl edit configmap coredns -n kube-system
下面為配置 db.example.com.tw 的 dns 範例
1.:53 {
2 errors
3 health
4 kubernetes cluster.local in-addr.arpa ip6.arpa {
5 pods insecure
6 fallthrough in-addr.arpa ip6.arpa
7 }
8 prometheus :9153
9 forward . /etc/resolv.conf
10 cache 30
11 loop
12 reload
13 loadbalance
14}
15
16db.example.com.tw:53 {
17 errors
18 cache 30
19 forward . 192.168.1.130
20 reload
21}
配置 hosts
1.:53 {
2 errors
3 health
4 kubernetes cluster.local in-addr.arpa ip6.arpa {
5 pods insecure
6 fallthrough in-addr.arpa ip6.arpa
7 }
8 hosts {
9 127.0.0.1 localhost
10 ::1 localhost
11 10.1.2.3 abc.example.com
12 fallthrough # If you want to pass the request to the rest of the plugin chain if there is no match in the _hosts_ plugin, you must specify the `fallthrough` option.
13 }
14 prometheus :9153
15 forward . /etc/resolv.conf
16 cache 30
17 loop
18 reload
19 loadbalance
20}
同時配置時
若同時配置時, 則會以 DNS Server 為優先.
comments powered by Disqus