kubernetes load balancer same ip adress different ports

1/19/2022

I have 3 different services and their service types LoadBalancer. Each one has different external ip. However I want to use one ip address for every one but different ports as external ip. Is it possible?

-- oakkose
kubernetes

2 Answers

1/19/2022

The only way you can have the same IP across different services that I am aware of, is to use an Ingress. But depending on the controller implementation, you may only be able to use ports 80/443.

-- Blender Fox
Source: StackOverflow

1/19/2022

You can implement it using ingress.

  1. Let you applications deployed using the Deployment type workload
  2. Expose your deployments using services
  3. Install ingress controller (you can use nginx ingress controller)
  4. Create your ingress resource to route your request based on a particualr context to a particular service.

Here is the reference from the kubernetes documentation which clearly elaborates on it - https://kubernetes.io/docs/concepts/services-networking/ingress/#simple-fanout

-- sb9
Source: StackOverflow