HAProxy Ingress Rewrite rules seemed not applied

Viewed 345

I'm trying to setup a simple ingress with path rewriting to pass requests to my backend services.

Ref.: https://haproxy-ingress.github.io/v0.10/docs/configuration/keys/#rewrite-target

The ingress controller uses this image: quay.io/jcmoraisjr/haproxy-ingress:v0.10-beta.1.

Here is sample YAML:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: "myapp-apis-ingress"
  namespace: "my-namespace"
  labels:
    app: myapp
    tier: ingress
  annotations:
    kubernetes.io/ingress.class: "haproxy"
    haproxy.org/rewrite-target: "/"
spec:
  rules:
    - host: "myapp.mydomain"
      http:
        paths:
          - path: /api/v1/hello
            pathType: Prefix
            backend:
              service:
                name: "myapp-hello-svc"
                port:
                  number: 8080

Expected behaviour:

  • It should route requests from https://myapp.mydomain/api/v1/hello/* to the GKE service at myapp-hello-svc:8080/*

Actual behaviour:

  • It routes everything to myapp-hello-svc:8080/api/v1/hello/* (myapp-hello-svc pod receives GET /api/v1/hello/*

I've tried some other combinations and rules, but none seemed working neither.

Any ideas what I may have missed here? Thanks!

UPDATE: WORKAROUND

As currently I still can't find solution to this, I decided to use workaround by adding NGINX ingress controller to K8S cluster and routing the traffic for new APIs through it instead.

0 Answers
Related