0

I'm using helm chart https://artifacthub.io/packages/helm/haproxy-ingress/haproxy-ingress to install haproxy-ingress into my kubernetes cluster.

I am wanting to expost tcp services externally. I can successfully do that using these helm values:

controller:
  replicaCount: 2
  ingressClassResource:
    enabled: "true"
  service:
    annotations:
      service.beta.kubernetes.io/azure-load-balancer-internal: "true"
    externalTrafficPolicy: Local
    loadBalancerIP: 10.10.71.249
 tcp:
   "8883": <namespace>/<service>:8883::PROXY:<namespace>/<tls-cert-secret-name>

However, I don't want to do it that way. Instead I'd like to use ingresses to inject the config into haproxy as noted at https://haproxy-ingress.github.io/docs/configuration/keys/#tcp-services.

The reason for this is because I want to use the same tcp port for multiple backend services and according to what I've read it is possible.

Here is my example ingress definition for two applications:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    haproxy.org/check: "true"
    haproxy-ingress.github.io/tcp-service-port: "8883"
  name: app-1
  namespace: ns1
spec:
  ingressClassName: haproxy
  rules:
  - host: app-1.example.com
    http:
      paths:
      - backend:
          service:
            name: app-1-service
            port:
              number: 8883
        pathType: ImplementationSpecific
  tls:
  - hosts:
    - app-1.example.com
    secretName: wildcard-example-com-cert
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    haproxy.org/check: "true"
    haproxy-ingress.github.io/tcp-service-port: "8883"
  name: app-2
  namespace: ns2
spec:
  ingressClassName: haproxy
  rules:
  - host: app-2.example.com
    http:
      paths:
      - backend:
          service:
            name: app-2-service
            port:
              number: 8883
        pathType: ImplementationSpecific
  tls:
  - hosts:
    - app-2.example.com
    secretName: wildcard-example-com-cert

Examining /etc/haproxy/haproxy.cfg I can see that the backend config was added for both applications, but I have not been able to connect from outside of the cluster.

The logs aren't showing anything.

So my real question is can what I'm trying to accomplish be done? If the answer is yes, then what other config am I missing or is something wrong?

xadamz23
  • 1
  • 1

0 Answers0