<p>I'm trying to figure out how to run openvpn server running inside a pod using UDP protocol.</p>

<p>Since it's easier to test using http than openvpn connections, I have also nginx-container running inside that same pod as openvpn-container is.</p>

<p>I can get everything working inside the cluster but I cannot expose this nginx service to Internet using my elastic ip.</p>

<p>Network is Weave.</p>

<p>Kubernetes version is 1.6</p>

<p>I have set the externalIPs-field in the service.yaml to my elastic ip address. I cannot use type LoadBalancer since my protocol is UDP.</p>

<p>Service:</p>

<pre><code># kubectl describe service openvpn                              
Name:           openvpn
Namespace:      default
Labels:         name=openvpn
Annotations:        kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"name":"openvpn"},"name":"openvpn","namespace":"default"},"spec":{"externalI...
Selector:       name=openvpn
Type:           NodePort
IP:         100.71.93.74
External IPs:       &lt;my_elastic_ip&gt;
Port:           openvpn 1194/UDP
NodePort:       openvpn 30726/UDP
Endpoints:      100.120.0.1:1194
Port:           http    80/TCP
NodePort:       http    30000/TCP
Endpoints:      100.120.0.1:80
Session Affinity:   None
Events:         &lt;none&gt;
</code></pre>

<p>Endpoints</p>

<pre><code># kubectl get endpoints openvpn  
NAME      ENDPOINTS                         AGE
openvpn   100.120.0.1:80,100.120.0.1:1194   20h
</code></pre>

<p>I have followed through the <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/</a> and everything works inside the cluster.</p>

<p>I have allocated the elastic ip to this specific instance manually using AWS Console. All security groups are updated.</p>

<p>So is it even possible to connect to a pod inside a kubernetes cluster using a elastic ip attached to that host node? If it is, how to do that?</p>

<p>Rather than use an IP address you could get K8S to use the type: <code>LoadBalancer</code> which will setup a Classic AWS ELB. From there you could CNAME a domain / sub-domain to the ELB and access the service that way?</p>

<p>A quick example:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: MyApp
  labels:
    app: MyApp
spec:
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: 80
    name: MyApp
  selector:
    app: MyApp
</code></pre>
