Ingress route not working to expose kong-proxy


#1

Ingress-controller: haproxy
Ingress Route:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sample-ingress-routes
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:

  • host: app1.sample.com
    http:
    paths:
    • backend:
      serviceName: kong-proxy
      servicePort: 8000
      path: /app
      Result:
      HTTP/1.1 404 Not Found
      Date: Thu, 17 Jan 2019 08:48:21 GMT
      Content-Length: 21
      Content-Type: text/plain; charset=utf-8
      Kong-Proxy not expose to world using ClusterIP, created ingressroute with specified hostname, the request forward to backend service like Kong-Proxy
      Any change required in my ingress route

#2

Hey,

Kong does not support rewrite target annotation:
ingress.kubernetes.io/rewrite-target: /

you need to create custom resource kongIngress with strip_path param enabled and associate it with Ingress resource:

   kind: Ingress
    metadata:
    name: sample-ingress-routes
    annotations:
      configuration.konghq.com: kong-custom-ingress

kongIngress:

apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  name: kong-custom-ingress
proxy:
  path: /
route:
  strip_path: true

#3

I am using haproxy ingress controller not kong ingress controller.
the ingress route works with default namespace, but my service are running in different namespace lets example
all kong services are running in kong namespace, haproxy proxy ingress controller running in ingress namespace.
I created sample ingress route with default namespace

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sample-ingress-routes
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:

  • host: app1.test.com
    http:
    paths:
    • backend:
      serviceName: kongproxy
      servicePort: 8000
      path: /app

Ingress controller doesn’t know the services running in kong namespace, so i created service to route to kong svc
apiVersion: v1
kind: Service
metadata:
name: kongproxy
namespace: ingress
spec:
type: ExternalName
externalName: kong-proxy.kong.svc.cluster.local
ports:

  • port: 8000
    protocol: TCP

The ingress route working fine as expected , if i remove annotations & path, then the ingress looking in the default namespace not in kong namespace.


#4

we used HAproxy ingress controller