Когда я использовал команду apt-get для обновления модулей kubernetes (v1.15.2), это не удалось:

root@nginx-deployment-5754944d6c-7gbds:/# apt-get update
Err http://security.debian.org wheezy/updates Release.gpg
  Temporary failure resolving 'security.debian.org'
Err http://http.debian.net wheezy Release.gpg               
  Temporary failure resolving 'http.debian.net'
Err http://http.debian.net wheezy-updates Release.gpg       
  Temporary failure resolving 'http.debian.net'
Err http://nginx.org wheezy Release.gpg                     
  Temporary failure resolving 'nginx.org'
Reading package lists... Done
W: Failed to fetch http://http.debian.net/debian/dists/wheezy/Release.gpg  Temporary failure resolving 'http.debian.net'

W: Failed to fetch http://http.debian.net/debian/dists/wheezy-updates/Release.gpg  Temporary failure resolving 'http.debian.net'

W: Failed to fetch http://security.debian.org/dists/wheezy/updates/Release.gpg  Temporary failure resolving 'security.debian.org'

W: Failed to fetch http://nginx.org/packages/mainline/debian/dists/wheezy/Release.gpg  Temporary failure resolving 'nginx.org'

W: Some index files failed to download. They have been ignored, or old ones used instead.

Теперь я могу успешно пропинговать свой kube-dns (ip: 10.96.0.10, coredns version 1.6.7):

root@nginx-deployment-5754944d6c-7gbds:/# cat /etc/resolv.conf 
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

root@nginx-deployment-5754944d6c-7gbds:/# ping 10.96.21.92
PING 10.96.21.92 (10.96.21.92): 48 data bytes
^C--- 10.96.21.92 ping statistics ---
11 packets transmitted, 0 packets received, 100% packet loss
root@nginx-deployment-5754944d6c-7gbds:/# ping 10.96.0.10 
PING 10.96.0.10 (10.96.0.10): 48 data bytes
56 bytes from 10.96.0.10: icmp_seq=0 ttl=64 time=0.103 ms
56 bytes from 10.96.0.10: icmp_seq=1 ttl=64 time=0.094 ms
56 bytes from 10.96.0.10: icmp_seq=2 ttl=64 time=0.068 ms
56 bytes from 10.96.0.10: icmp_seq=3 ttl=64 time=0.066 ms
56 bytes from 10.96.0.10: icmp_seq=4 ttl=64 time=0.060 ms
56 bytes from 10.96.0.10: icmp_seq=5 ttl=64 time=0.064 ms

Почему стручки не могли получить доступ к сети? Теперь я не мог установить какой-либо инструмент, чтобы проверить проблему с сетью модулей в этом модуле. Что мне делать, чтобы узнать, где что-то не так?

Я попытался создать busybox и протестировать kube-dns следующим образом:

[miao@MeowK8SMaster1 ~]$ kubectl exec -it busybox -- nslookup kubernetes
Server:    10.96.0.10
Address 1: 10.96.0.10

nslookup: can't resolve 'kubernetes'
command terminated with exit code 1
1
Dolphin 31 Май 2020 в 13:57

1 ответ

Лучший ответ

Я понимаю, почему вам нужно исполнять в coredns pod.

Однако он позволяет выполнять только двоичный код coredns (но не любую оболочку).

Например:

k exec -it <<coredns podname>> -n kube-system -- ./coredns -version

Это вернет версию запущенного двоичного файла coredns.

1
Thilee 8 Июн 2020 в 03:28