Pod无法安装软件包(apt-get更新或apt-get安装) [英] Pod unable to install packages(apt-get update or apt-get install )
问题描述
我观察到,将exec执行到pod时,群集中的pod无法安装软件包.调试时,我意识到它是由于/etc/resolv.conf
项引起的.
I have observed that the pods in my cluster is not able to install the packages when exec to the pod . While debugging i have realized that its due to /etc/resolv.conf
entries.
其中一个Pod的/etc/resolv.conf
条目是:
The /etc/resolv.conf
entry from one of the pod is :
nameserver 192.168.27.116
search ui-container.svc.cluster.local svc.cluster.local cluster.local 192.168.27.116.nip.io
options ndots:5
在这里,如果我从所有主节点,工作节点的resolv.conf中删除条目 192.168.27.116.nip.io
,则Pod将能够连接到Internet和 apt-get install
起作用.这只是暂时的解决方法,因为不建议您更新resolv.conf.因为我已经观察到resolv.conf的内容在节点重启后重新设置为原始.
Here if i remove a entry 192.168.27.116.nip.io
from the resolv.conf of all the master, worker nodes then the pods will be able to connect to internet and apt-get update
and apt-get install
works. This is only a temporary workaround because it is not recommended to update the resolv.conf. because i have observed that resolv.conf contents gets re-set to original upon reboot of the nodes.
是由于/etc/resolv.conf
中的 options ndots:5
吗?
我该如何解决?
推荐答案
作为一个快速解决方案,您可以利用pod Spec中的dnsConfig覆盖默认的dns配置,更多详细信息:
As a quick-fix, you could leverage dnsConfig from pod Spec to override default dns configuration, more details: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
这篇关于Pod无法安装软件包(apt-get更新或apt-get安装)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!