Rancher Kubernetes无法创建持久卷声明

时间:2020-01-31 14:55:54

标签: kubernetes vmware rancher persistent-volumes

我无法在Kubernetes(Rancher 2.3)中创建持久卷声明。

我的存储类使用由Rancher提供的VMware云提供程序'vSphere Storage for Kubernetes'

在rancher Web界面中,事件显示如下错误:

(combined from similar events): Failed to provision volume with StorageClass "t-a-g1000-t6m-e0fd": Post https://vsphere.exemple.com:443/sdk: dial tcp: lookup vsphere.exemple.com on [::1]:53: read udp [::1]:51136->[::1]:53: read: connection refused

我在Kubernetes Master上遇到相同的错误:

docker logs kube-controller-manager

1 个答案:

答案 0 :(得分:1)

由于某种原因,kubernet master上的kube-controller-manager pod的DNS解析器为空:

docker exec  kube-controller-manager cat /etc/resolv.conf
# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line

由于主机服务器resolv.conf是正确的,所以我只是重新启动了容器:

docker restart kube-controller-manager

(另一种难看的方法是使用docker restart kube-controller-manager手动编辑resolv.conf,然后运行适当的echo XXX >> /etc/resolv.conf ...不好的主意)


其他一些容器在此节点上可能有类似的问题。这是一种识别并重新启动这些容器的方法:

cd  cd /var/lib/docker/containers
ls -1 "$(grep nameserver -L */resolv.conf)" | sed -e 's#/.*##' 
0c10e1374644cc262c8186e28787f53e02051cc75c1f943678d7aeaa00e5d450
70fd116282643406b72d9d782857bb7ec76dd85dc8a7c0a83dc7ab0e90d30966
841def818a8b4df06a0d30b0b7a66b75a3b554fb5feffe78846130cdfeb39899
ae356e26f1bf8fafe530d57d8c68a022a0ee0e13b4e177d3ad6d4e808d1b36da
d593735a2f6d96bcab3addafcfe3d44b6d839d9f3775449247bdb8801e2e1692
d9b0dfaa270d3f50169fb1aed064ca7a594583b9f71a111f653c71d704daf391

重新启动受影响的容器:

cd /var/lib/docker/containers ; ls -1 $(grep nameserver -L */resolv.conf) | sed -e 's#/.*##' | xargs -n1 -r docker restart