Exposing kubernetes service using elastic ip address on aws

Viewed 3626

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

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.

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

Network is Weave.

Kubernetes version is 1.6

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.

Service:

# 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:       <my_elastic_ip>
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:         <none>

Endpoints

# kubectl get endpoints openvpn  
NAME      ENDPOINTS                         AGE
openvpn   100.120.0.1:80,100.120.0.1:1194   20h

I have followed through the https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/ and everything works inside the cluster.

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

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?

2 Answers
Related