Moving a kubernetes service from Loadbalancer to Ingress

1/23/2021

Currently, we are using a loadbalancer type srevice for routing external requests to one of our pods.

We would like to move this to an ingress type service ( there is already an external load balancer setup along with an ingress controller - and we do have other pods configured to receive external requests via this ingress controller)

What we have now is the below url, used by the clients to connect externally:

ws://streamevents.app.com:7080/stomp
wss://streamevents.app.com:7443/stomp

We would like to move it to

ws://streameventsv2.app.com/stomp
wss://streameventsv2.app.com/stomp

This way, we can free up the loadbalancer IP and do not need specific ports. We do want to support both url's together for a while - since clients are already connecting to the old one. How could we achieve this?

Options I can think of (we use helm):

  • Create a separate chart and deployment with the Ingress service - the old one still uses the LoadBalancer
  • Same chart - expose the service both ways (is this really possible?)
  • Change the current one to Ingress - and somehow also make sure we route requests to the old url to the new ingress (how?)

Or any other possible approaches?

-- Chillax
kubernetes
kubernetes-helm
kubernetes-ingress
kubernetes-networking

1 Answer

1/23/2021

I'm guessing you own the helm chart and hence you can make changes to it. If so, you can expose your service both using Ingress and LoadBalancer service. You don't need any changes in any other resources in the helm chart other than adding an Ingress resource. You can remove the LoadBalancer object when you can stop supporting it.

-- Shashank V
Source: StackOverflow