Kubernetes (AKS) : Expose multiple ports of different service to common load balancer listening on same path

Posted April 17, 2019 5.8k views
Ubuntu 16.04Kubernetes

I am setting up Kubernetes cluster on Azure (using AKS) to host Elasticsearch, Kibana, custom api, UI, nginx, etc.

As I don’t want separate public IP per service, I need a way to setup a common load balancer/Ingress and then just add the port numbers to there and setup routing.

I tried using the approach mentioned in this stackoverflow question - How to expose multiple port using a load balancer services in kubernetes but didn’t work out.

As there are technology clients connecting to my cluster, I need to have service per technology.

Basically I need to expose 9200, 5601, 80 - all on same IP but on accessing the IP with port, user must be re-directed to appropriate technology service.

Below is sample configuration for what am looking for.

apiVersion: extensions/v1beta1
kind: Ingress
  name: myingress
  - host:
      - path: /
          serviceName: elasticsearch
          servicePort: 9200
      - path: /
          serviceName: kibana
          servicePort: 5602

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

You can use Traefik as a Ingress Controller.

That should work. I have one similar solution implemented.*laQBZYKVPlcAxrv3Vuo65w.png