[英]Kubernetes NFS: Using service name instead of hardcoded server IP address
I was able to get it working following NFS example in Kubernetes. 我能够按照Kubernetes中的NFS示例使其工作。
https://github.com/kubernetes/kubernetes/tree/master/examples/volumes/nfs https://github.com/kubernetes/kubernetes/tree/master/examples/volumes/nfs
However, when I want to automate all the steps, I need to find the IP and update nfs-pv.yaml
PV file with the hard coded IP address as mentioned in the example link page. 但是,当我想自动化所有步骤时,我需要找到IP并使用示例链接页面中提到的硬编码IP地址更新
nfs-pv.yaml
PV文件。
Replace the invalid IP in the nfs PV.
替换nfs PV中的无效IP。 (In the future, we'll be able to tie these together using the service names, but for now, you have to hardcode the IP.)
(将来,我们将能够使用服务名称将它们捆绑在一起,但现在,您必须对IP进行硬编码。)
Now, I wonder that how can we tie these together using the services names ? 现在,我想知道如何使用服务名称将它们捆绑在一起 ?
Or, it is not possible at the latest version of Kubernetes (as of today, the latest stable version is v1.6.2 ) ? 或者,在最新版本的Kubernetes上是不可能的(到目前为止,最新的稳定版本是v1.6.2 )?
I got it working after I add kube-dns address to the each minion|node where Kubernetes is running. 在将kube-dns地址添加到运行Kubernetes的每个minion |节点后, 它就可以工作了。 After login each minion, update resolv.conf file as the following;
登录每个奴才后,按以下步骤更新resolv.conf文件;
cat /etc/resolv.conf
# Generated by NetworkManager
search openstacklocal localdomai
nameserver 10.0.0.10 # I added this line
nameserver 159.107.164.10
nameserver 153.88.112.200
....
I am not sure is it the best way but this works. 我不确定这是否是最好的方法,但这是可行的。
Any better solution is welcome. 任何更好的解决方案都是值得欢迎的。
You can use do this with the help of kube-dns
, check whether it's service running or not, 您可以在
kube-dns
的帮助下执行此操作,检查它是否正在运行服务,
kubectl get svc --namespace=kube-system
and kube-dns pod also, 还有kube-dns pod
kubectl get pods --namespace=kube-system
you have to add respected name-server according to kube-dns on each node in cluster, For more troubleshooting, follow this document, https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/ 您必须根据群集中每个节点上的kube-dns添加受尊敬的名称服务器,有关更多故障排除,请遵循此文档, https: //kubernetes.io/docs/concepts/services-networking/dns-pod-service/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.