差異處
這裏顯示兩個版本的差異處。
tech:rancher_coredns_hosts [2021/01/27 15:44] – 建立 jonathan | tech:rancher_coredns_hosts [2021/01/27 15:48] (目前版本) – jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
====== 針對 K8s 環境內定義類似 /etc/hosts 方式 ====== | ====== 針對 K8s 環境內定義類似 /etc/hosts 方式 ====== | ||
+ | * 以下是在 rancher 下的設定方式 | ||
+ | * Clusters(已經建立的 Cluster) -> System | ||
+ | * Resources -> Config -> Namespace: kube-system -> coredns -> Edit | ||
+ | * Corefile 的內容改成類似以下: | ||
+ | .:53 { | ||
+ | errors | ||
+ | health { | ||
+ | lameduck 5s | ||
+ | } | ||
+ | ready | ||
+ | kubernetes cluster.local in-addr.arpa ip6.arpa { | ||
+ | pods insecure | ||
+ | fallthrough in-addr.arpa ip6.arpa | ||
+ | } | ||
+ | prometheus :9153 | ||
+ | forward . "/ | ||
+ | cache 30 | ||
+ | loop | ||
+ | reload | ||
+ | loadbalance | ||
+ | hosts iiidevops.tw { | ||
+ | 192.168.7.101 www.iiidevops.tw | ||
+ | 192.168.7.101 gitlab.iiidevops.tw | ||
+ | 192.168.7.101 redmine.iiidevops.tw | ||
+ | 192.168.7.101 harbor.iiidevops.tw | ||
+ | 192.168.7.101 sonarqube.iiidevops.tw | ||
+ | fallthrough | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | * Save 存檔就可以立即生效 | ||
===== 參考網址 ===== | ===== 參考網址 ===== |