Kong for K8 does not honor strip-path annotations in the ingress resource

Summary

Kong for K8 does not honor strip-path annotations in the ingress resource.

Kong Ingress controller version
1.5.1-centos

Kubernetes version

1.17.4

Environment

Cloud: AWS
OS: Centos

What happened

We have ingress resource with the following annotations.
kubernetes.io/ingress.class: “kong”
konghq.com/strip-path: “false”

ingress resource path is “/share”. for e.g ingress.yaml
paths:

  • path: /share

Kong proxy is updating routes.strip-path field in kong database to “TRUE” and stripping the path “/share/” from the path while forwarding the request. for e.g path with “/share/page/index.html” is getting forwarded to backend as “/page/index.html”

Expected behavior

We expected Kong proxy to update routes.strip-path field in kong database to false but the value is always TRUE for all routes. We expected Kong proxy to not strip the path vaule “/share” and forward the request to backend service with the correct path “/share/*”. for e.g path with “/share/page/index.html” should get forwarded to backend as “/share/page/index.html”

Is this using DB-less mode or a database? If the latter, does this correct itself if you delete the entity (to force the controller to create it again)?

There are a few edge cases where optimizations in the sync loop cause it to miss discrepancies in database-backed mode. We’re working on clearing those in future versions.

If that does not work, or you’re using DB-less mode, can you provide the Ingress and Service definition in question for us to try and replicate?

You are using an annotation introduced in 0.8.0 version of the controller, please make sure you are using the latest version of the controller. Thanks!

Thanks for the reply.

I was able to upgrade Kong to 0.8.1 and that resolved the annotation issue.

however I did a fresh deployment of Kong 0.8.1 and I get the following error in the Kong ingress controller and the ingress controller fails to start.

E0529 15:44:15.767512 1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.4/tools/cache/reflector.go:105: Failed to list *v1.KongClusterPlugin: the server could not find the requested resource (get kongclusterplugins.configuration.konghq.com)
E0529 15:44:15.768133 1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.4/tools/cache/reflector.go:105: Failed to list *v1beta1.TCPIngress: the server could not find the requested resource (get tcpingresses.configuration.konghq.com)

these are my permissions in the cluster role. Do we require any additional permissions ?

  • apiGroups:
    • configuration.konghq.com
      resources:
    • kongplugins
    • kongclusterplugins
    • kongcredentials
    • kongconsumers
    • kongingresses
    • tcpingresses

Your cluster is missing the two CRDs that were introduced in 0.8.0. Please install them to fix those problems.
Thanks.

Hi Hbagdi

Can you please point me to the two CRD’s that are needed for new Kong version ? I could not find reference to them in this document.

thanks in advance.
Thanks
Gajanan

The two new ones are TCPIngress and KongClusterPlugin