Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To configure haproxy-ingress to allow access to multiple backend services using the same port, depending on the respective hostname, follow these steps:

  1. Install haproxy-ingress controller in your Kubernetes cluster using a Helm chart or any other method.
  2. Create separate Kubernetes Services for each of your backend services.
  3. Add label selector fields to each of the services to identify them uniquely. For example, you can have two backend services with the labels app: service1 and app: service2 respectively.
  4. Create a Kubernetes Ingress resource that will use haproxy-ingress as the controller, and specify a hostname for each backend service you want to expose. For example:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    ingress.kubernetes.io/ssl-redirect: "false"    #Disable SSL redirect
spec:
  rules:
    - host: service1.example.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: service1
              servicePort: 80
    - host: service2.example.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: service2
              servicePort: 80

This YAML file defines an Ingress resource that will expose two backend services named service1 and service2, each at a different hostname. The haproxy-ingress controller will route requests to the appropriate backend service based on the hostname specified in the request.

In this way, you can configure haproxy-ingress to allow access to multiple backend services using the same port, depending on the respective hostname.