3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

k8s : coredns から DNSサーバへの要求が i/o timeout になる

Posted at

参考資料

HINFO: unreachable backend: read udp 10.200.0.9:46159->183.60.83.19:53: i/o timeout #2693 (github.com)
kubeadm Hosted Install (projectcalico.org)
About Calico (projectcalico.org)

TL;DR

とりあえずcalico入れましょう。

kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml

環境情報

  • k8s: v1.15.2
  • flannel: v0.11.0-amd64

状況

GoogleのDNSサーバ8.8.8.8corednsがクエリを出して、I/Oタイムアウトになっている。
(下の方は別Pod(ここredis)からapt-getを実行した際に、DNSで名前解決が出来なかった時のログ)

kubectl logs coredns-5c98db65d4-ncvzf -n kube-system

.:53
2019-08-07T07:36:51.802Z [INFO] CoreDNS-1.3.1
2019-08-07T07:36:51.802Z [INFO] linux/amd64, go1.11.4, 6b56a9c
CoreDNS-1.3.1
linux/amd64, go1.11.4, 6b56a9c
2019-08-07T07:36:51.802Z [INFO] plugin/reload: Running configuration MD5 = 5d5369fbc12f985709b924e721217843
2019-08-07T07:36:57.845Z [ERROR] plugin/errors: 2 1047693481524218727.620094442431543579. HINFO: read udp 192.168.122.67:40976->8.8.8.8:53: i/o timeout
...
2019-08-07T07:53:11.277Z [ERROR] plugin/errors: 2 deb.debian.org. A: read udp 192.168.122.67:60325->8.8.8.8:53: i/o timeout
2019-08-07T07:53:11.277Z [ERROR] plugin/errors: 2 security.debian.org. A: read udp 192.168.122.67:35165->8.8.8.8:53: i/o timeout
2019-08-07T07:53:17.315Z [ERROR] plugin/errors: 2 deb.debian.org. A: read udp 192.168.122.67:51408->8.8.8.8:53: i/o timeout

pingは通る

etcdのPodに入り、ルータのIPアドレス、GoogleのDNSサーバへpingでパケット送信成功した。どこが問題?

kubectl exec -it etcd-xubuntu -n kube-system -- /bin/sh

ping <router_ip_address>
...

ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=52 time=19.037 ms

corednsに他PodからDNS要求されているか

※これは今回の件と関係ないが一応のチェック

etcd/etc/resolv.confでDNSサーバのIPアドレスを見てみる・・・10.96.0.10がDNSサーバね

cat /etc/resolv.conf

nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

corednsのサービス状態も見てみる・・・etcdが持ってるIPアドレスと一致した
(apt-getを実行したredisでも一致)

kubectl get svc --namespace=kube-system

NAME       TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
kube-dns   ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   46m

解決

HINFO: unreachable backend: read udp 10.200.0.9:46159->183.60.83.19:53: i/o timeout #2693 (github.com)
のコメントにある通り、calicoを使ってみる

kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml

configmap/calico-config created
daemonset.extensions/calico-etcd created
service/calico-etcd created
daemonset.extensions/calico-node created
deployment.extensions/calico-kube-controllers created
clusterrolebinding.rbac.authorization.k8s.io/calico-cni-plugin created
clusterrole.rbac.authorization.k8s.io/calico-cni-plugin created
serviceaccount/calico-cni-plugin created
clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created
clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created
serviceaccount/calico-kube-controllers created

全部のPodがn/n Runningになるのを待ち、redisに入って

kubectl exec -it redis -- /bin/bash

apt-getを実行したら、成功した。

apt-get update

Hit:1 http://security-cdn.debian.org/debian-security buster/updates InRelease
Hit:2 http://cdn-fastly.deb.debian.org/debian buster InRelease
Hit:3 http://cdn-fastly.deb.debian.org/debian buster-updates InRelease
Reading package lists... Done

calicoって?
About Calico (projectcalico.org)
CNI(Container Networking Interface)の実装でした。
元々flannelでCNIを担ってたんですが、設定がマズイのかflannelだとcorednsがきちんと動かなかったようです。。
原因自体にたどり着いていないので消化不良ですが、今回は調査終了します。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?