2
votes

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
metadata:
  name: myingress
spec:
  rules:
  - host: myurl.domain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: elasticsearch
          servicePort: 9200
      - path: /
        backend:
          serviceName: kibana
          servicePort: 5602

Any thoughts?

3
am not looking for /url1 redirect to 5601 and /url2 redirect to 9200. What i need is, if url has port 5601, redirect to 5601 and same for 9200. Basically don't create public URL per serviceSunil Agarwal

3 Answers

1
votes

With your issue, the ingress is what you want. You can create all your services as you want. And expose the ports for your service. Then create the ingress with a public IP and create the ingress route that routes the access from the ingress to your backend services.

Take a look at the example in Create an ingress controller in Azure Kubernetes Service (AKS). It will show you what the steps need to be done. And if you have more questions please let me know.

0
votes

Sorry i posted another similar question. Finally was able to solve with issue with simple tagging.

No extra tools/code required.

Please refer my post for answer : Kubernetes: Expose multiple services internally & externally