Simple example with path, not host

I’ve tried a bit but so far couldn’t get it to work. Is there a simple example somewhere for an Ingress configuration that uses only path instead of host.

Simplistic examples like the one below are not working for me, with and without KongIngress. The referred service exists and is working fine. Also, I’ve checked the kong database and don’t see anything there. On the other hand, if I create Ingress with host definition then I see the database being populated.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: http-svc-ingress
spec:
rules:

  • http:
    paths:
    • path: /http-svc
      backend:
      serviceName: http-svc
      servicePort: 80

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

Regards,
Luiz

Which version of Ingress Controller and Kong are you using?

It’s whatever is defined in your master branch. I got it from here: https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/deployment/openshift.md.
That works, but not when I try to have an api using path only, like above.

…and looking at the deployment configuration, these are the images being used:

kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.2.0
kong:0.14.1-centos

Also fails on Minishift. Interesting enough, it works with Minikube.

Anyway, you should be able to reproduce the issue. Standard install plus the Ingress definition above.

Luizs-MacBook-Pro:kong-ingress lomori$ http {PROXY_IP}:{HTTP_PORT}/http-svc
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Length: 58
Content-Type: application/json; charset=utf-8
Date: Wed, 26 Dec 2018 16:17:41 GMT
Server: kong/0.14.1

{
“message”: “no route and no API found with those values”
}

This might be due to Openshift YAML definitions being out of date in master branch but the regular k8s YAMLs files are up to date as most people (including the devs) all use the regular k8s flavor.

I’ve added a task to my todo to update it. Meanwhile, a PR is also welcome.

Humm, didn’t see anything special there. It’s puzzling that the API selection by Host works but not by Path. Do you do anything special for the latter? I looked at the logs (normal level, v=3 is too verbose) and the Ingress appears to be trying to create the service/route (same output as for the Host case) and no errors are reported, but when I try to retrieve from the admin endpoint, it’s not there.

It seems the version being used for Openshift is an older version.

From the changelog, path based routing was introduced in 0.2.1: