CoreDNS
基礎知識
Corefile の設定方法
Corefile は ConfigMap として渡される。
$ kubectl get configmap -n kube-system
NAME DATA AGE
coredns 1 22m
extension-apiserver-authentication 6 22m
kube-proxy 2 22m
kubeadm-config 1 22m
kubelet-config-1.11 1 22m
weave-net 0 22m
describe してみる。
kubectl describe configmap coredns -n kube-system
Name: coredns
Namespace: kube-system
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","data":{"Corefile":".:53 {\n errors\n health\n kubernetes nextgen.cloud in-addr.arpa ip6.arpa {\n pods insecure\n ...
Data
====
Corefile:
----
.:53 {
errors
health
kubernetes nextgen.cloud in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
proxy . /etc/resolv.conf
cache 30
reload
}
Events: <none>
クラスタの root zone の確認
Corefile の kubernetes plugin の引数を見ればよい。
上の例を使うと nextgen.cloud となる。
kubernetes nextgen.cloud in-addr.arpa ip6.arpa
操作関連
DNS サーバの IP アドレスの取得
Service の ClusterIP を見ればよい。
$ kubectl get service -n kube-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP 19m
Corefile の path 確認
kubectl exec で確認する。
$ kubectl exec coredns-78fcdf6894-hnp48 -n kube-system ps
PID USER TIME COMMAND
1 root 0:02 /coredns -conf /etc/coredns/Corefile
27 root 0:00 ps
