title: OpenVPN-Client Pod on K8s - Local network unreachable
body: <p>I'm currently trying to get OpenVPN client running inside of a K8s Pod. The goal i'm trying to achieve is that Im able access the internet over the VPN connection while also be able to communicate with other containers on my namespace at the same time. The problem is that im unable to interact with 10.42.0.0, 10.43.0.0 network (for pods and services) as soon as the VPN connection is established :(</p>
  <p>Can smb give me a hint on how to interact with the two mentioned networks while connected with the vpn?</p>
  <p>my client config (might be very faulty)</p>
  <pre><code>client
  dev tun
  proto udp
  remote some.vpnserver.com 443
  resolv-retry infinite
  nobind
  persist-key
  persist-tun
  persist-remote-ip
  redirect-gateway def1 bypass-dns
  dhcp-option DOMAIN-SEARCH cluster.local
  dhcp-option DOMAIN-SEARCH svc.cluster.local
  dhcp-option DOMAIN-SEARCH default.svc.cluster.local
  dhcp-option DNS 10.43.0.10
  pull-filter ignore block-outside-dns
  pull-filter ignore redirect-gateway
  pull-filter ignore explicit-exit-notify
  pull-filter ignore &quot;dhcp-option DNS&quot;
  
  verify-x509-name some.vpnserver.com name
  auth-user-pass
  comp-lzo
  keepalive 10 60
  verb 3
  auth SHA256
  cipher AES-256-CBC
  tls-cipher TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA
  
  &lt;ca&gt;
  -----BEGIN CERTIFICATE-----
  ...
  -----END CERTIFICATE-----
  -----BEGIN CERTIFICATE-----
  ...
  -----END CERTIFICATE-----
  &lt;/ca&gt;
  </code></pre>
  <p>I also added the following to my deployment yaml:</p>
  <pre><code>  capabilities:
      add:
        - NET_ADMIN
        - SYS_MODULE
    dnsConfig:
      nameservers:
        - 10.43.0.10 # K8s CoreDNS
      options:
        - name: ndots
          value: &quot;2&quot;
        - name: edns0
  </code></pre>
  <ul>
  <li><p>Ping 8.8.8.8 works for me while connected. But inside of the K8s namespace im not able to reache anything at all.</p>
  </li>
  <li><p>DNS does not work at all as soon as the VPN connection is established. The only way to make DNS work is to set the following at the deployment yaml:</p>
  <pre><code>dnsConfig:
    nameservers:
      - 1.1.1.1
  </code></pre>
  </li>
  </ul>
  <p>which still not solve the issue of interacting with the local network or local DNS/Pods etc?</p>
  <p>Im working on</p>
  <ul>
  <li>OpenVPN 2.5.0</li>
  <li>K8s 1.19.4</li>
  <li>CNI: Calico</li>
  </ul>
  <p>Thanks in advance, Im thanksful for every hint, I'm working on this since days</p>