How to access outside world from Kubernetes pod

8/3/2017

I faced with the problem that I cannot send emails from K8s pod using smtp.gmail.com and 587 port. I tried to use dnsPolicy: ClusterFirstWithHostNet but nothing has changed. With dnsPolicy: Default everything seems OK but I can't use this approach since pods should be able to resolve other pods from the cluster. Btw, ConfigMap with Google's dns didn't help too:

apiVersion: v1
kind: ConfigMap
metadata:
  name: kube-dns
  namespace: kube-system
data:
  upstreamNameservers: |
    [“8.8.8.8”, “8.8.4.4”]

Are there any ideas?
Thanks in advance.
PS, my Kubernetes version is v1.7.2

-- Andrey Pasika
kubernetes

2 Answers

8/4/2017

There is another approach to solve this problem - you can write Google DNS (8.8.8.8) in container's resolve.conf during its startup.

-- Andrey Pasika
Source: StackOverflow

8/4/2017

Maybe it just a syntax error in your configmap with quotes (" vs “) If you run kubectl -n kube-system logs kube-dns-xxxx -c dnsmasq you will get a syntax error, instead of upstreamNameservers to [8.8.8.8, 4.4.4.4]

-- ArthurMa
Source: StackOverflow