Kubernetes:从pod连接到外部世界 [英] Kubernetes: Connect to the outside world from pod

查看:117
本文介绍了Kubernetes:从pod连接到外部世界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台机器上有一个本地Kubernetes集群,还有一个需要接收URL的容器(例如 https://www.wikipedia.org/),然后从中提取文本内容.本质上,我需要我的Pod才能连接到外界.由于我使用的是v1.2.5,因此我需要一些DNS附加组件(例如SkyDNS),但找不到任何有效的示例或教程来进行设置. 之类的教程通常只会告诉我如何在其中制作豆荚群集通过DNS查找相互交谈.

I have a local Kubernetes cluster on a single machine, and a container that needs to receive a url (like https://www.wikipedia.org/) and extract the text content from it. Essentially I need my pod to connect to the outside world. Since I am using v1.2.5, I need some DNS add-on like SkyDNS, but I cannot find any working example or tutorial on how to set it up. Tutorials like this usually only tell me how to make pods within the cluster talk to each other by DNS look-up.

因此,有人可以给我一些有关如何设置和配置Kubernetes插件,以便Pod可以访问公共Internet的建议吗?非常感谢你!

Therefore, could anyone give me some advice on how to set up and configure an add-on of Kubernetes so that pods can access the public Internet? Thank you very much!

推荐答案

您只需使用"dnsPolicy:Default"创建您的Pod,就可以像在主机上一样为它提供一个resolv.conf,并且可以解析wikipedia.org.它无法解析集群本地服务.如果您希望实际部署kube-dns,以便也可以解析集群本地服务,那么这可能是最好的起点: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/

You can simply create your pods with "dnsPolicy: Default", this will give it a resolv.conf just like on the host and it will be able to resolve wikipedia.org. It will not be able to resolve cluster local services.If you're looking to actually deploy kube-dns so you can also resolve cluster local services this is probably the best starting point: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/

这篇关于Kubernetes:从pod连接到外部世界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆