Expose a service externally in TCP/UDP other than Loadbalancer

12/19/2017

I need to

  • expose some pods directly on nodes, for TCP & UDP
  • be able to access them externally, individually

I would like to avoid creating a loadbancer service for each pod as there is no need of loadbalancing, just the exposure to outside world.

I don see any solution with Service or Ingress.

All this happens in GKE.

Would someone have an idea?

thanks!

-- unludo
google-kubernetes-engine
kubernetes

1 Answer

12/19/2017

If your nodes are accessible from the outside world you can get away with just hostNetwork: true, there are some potential issues with it though (ie. just one pod per host or potential port conflicts with other stuff on node). You don't need any service defined for it, as it will just listen on your nodes ports (need to have them open on firewall, security policies or whatever guards your nodes from external world).

Any use of service (except for maybe headless one) will result in a loadbalancing between all backing pods (be it ClusterIP, NodePort or LB), but only LB service will give you a dedicated external IP.

-- Radek 'Goblin' Pieczonka
Source: StackOverflow