I have a Kubernetes cluster running applications (currently on a set of Vagrant CoreOS VMs on a local server)

I want to be able to debug a particular application locally on my laptop, so I worked on setting up VPN into the cluster: a client/server VPN based on kylemanna/docker-openvpn, deployed as a regular Pod

I created the cert/key pairs, client certs etc... I can connect to the VPN fine.

Now, connecting to the VPN server doesn't get me much if I can't access the Services. I have the DNS addon running skyDNS in the cluster. I can nslookup my services from other pods in the cluster, so all that works fine, but I can't resolve Services by name on the VPN client. I can ping Pods by IP from the VPN client (in the subnet but I can't resolve with DNS

a nslookup from the client returns:

nslookup myservice

** server can't find myservice: SERVFAIL

One of the problems of troubleshooting is that neither ping nor traceroute work on the DNS IP (from any pod), yet it resolves services, so nslookup is the way I know to check, but that is not very informative.

The VPN host IP the Pod binds to is The Kubernetes subnet is The SkyDNS server is at

The VPN server subnet is On the VPN server ifconfig gives:

eth0      Link encap:Ethernet  HWaddr 02:42:0A:02:16:45
          inet addr:  Bcast:  Mask:
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:  P-t-P:  Mask:

So is the Pod IP and the VPN Server IP is with the Gateway being i guess.

On the VPN server pod the routign table looks like:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    0      0        0 eth0       *        U     0      0        0 eth0   UG    0      0        0 tun0        *      UH    0      0        0 tun0   UG    0      0        0 tun0

I can reach my applications by IP (and get data) but couldn't when using the service IP (the proxy IP which is on the subnet)

I added the route route add -net gw to the VPN Server and I can then use the Service IP to get data but the nslookup just times out then.

I guess the traffic may not be coming back from the DNS. DNS is itself a proxied service in Kubernetes, so that adds a level of complexity. Not sure how to fix this.

2 Answers 2


finally my config looks like this:

docker run -v /etc/openvpn:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig \
-u udp:// \
-n \
-n \
-n \
-n \
-n \
-s \
-N \
-p "route" \
-p "route" \
-p "dhcp-option DOMAIN-SEARCH cluster.local" \
-p "dhcp-option DOMAIN-SEARCH svc.cluster.local" \
-p "dhcp-option DOMAIN-SEARCH default.svc.cluster.local"

-u for the VPN server address and port

-n for all the DNS servers to use

-s to define the VPN subnet (as it defaults to which is used by Kubernetes already)

-d to disable NAT

-p to push options to the client

-N to enable NAT: it seems critical for this setup on Kubernetes

the last part, pushing the search domains to the client, was the key to getting nslookup etc.. to work.

note that curl didn't work at first, but seems to start working after a few seconds. So it does work but it takes a bit of time for curl to be able to resolve.


Ran into the same issue a year ago and decided to make something specific for kubernetes: https://github.com/pieterlange/kube-openvpn

(based on kylemanna's openvpn docker image)

  • 2
    Could you please add some additional information about it here, e.g. in case the link stops working.
    – phk
    Mar 5, 2017 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .