Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes: Connect to the outside world from pod

Tags:

kubernetes

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.

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!

like image 639
Yunsheng Bai Avatar asked Jul 09 '16 19:07

Yunsheng Bai


1 Answers

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/

like image 165
Prashanth B Avatar answered Oct 19 '22 01:10

Prashanth B