KongIngress doesn't work for me


#1

Hi everyone!

Please help. I can create Kubernetes ingress resources, “KongConsumer” and “KongPlugin” resources in my setup. I’m trying to replace Kubernetes ingress with KongIngress, but still no luck here.
The standard Kubernetes ingress does not have those Kong-specific options I need, so is that possible to add those if I stay with Kubernetes resources? Here is my yaml:

---
apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  name: configuration-demo
upstream:
  hash_on: cookie
  hash_on_cookie: configuration-demo
  hash_fallback: none
  healthchecks:
    active:
      concurrency: 10
      healthy:
        http_statuses:
        - 200
        - 302
        interval: 0
        successes: 0
      http_path: "/"
      timeout: 1
      unhealthy:
        http_failures: 0
        http_statuses:
        - 429
        interval: 0
        tcp_failures: 0
        timeouts: 0
    passive:
      healthy:
        http_statuses:
        - 200
        successes: 0
      unhealthy:
        http_failures: 0
        http_statuses:
        - 429
        - 503
        tcp_failures: 0
        timeouts: 0
    slots: 10
proxy:
  host: "ololo.48020"
  protocol: http
  path: "/"
  port: 80
  retries: 0
  connect_timeout: 10000
  read_timeout: 10000
  write_timeout: 10000
route:
  methods:
  - GET
  regex_priority: 0
  strip_path: false
  preserve_host: true
  protocols:
  - http
  hosts: "ololo.com"
  paths:
  - "/auth/v3"

I just have this resource and no services and routes appear in Kong. The syncing ingress messages just go on without errors.
Thanks much!!

P.S.: This is the case where I would create multiple routes like:
/auth/v3/\S+/aaaa
/auth/v3/\S+/aaaa/qq
/auth/v3/\S+/aaaa/qq/\S+


#2

Hello @megastallman,

KongIngress object helps in extending the Ingress resource in k8s, which is fairly narrow in what it can define. It is not meant as a replacement to Ingress resource in k8s, but a mere extension to it.

You need to create an Ingress resource in Kubernetes which will be used to create Routes and Services in Kong. To tune setting of that Route/Service/Upstream in Kong, you can use KongIngress resource.

You do this by creating a KongIngress resource in k8s and then associate it with the Ingress resource.

Our documentation here will help you out on how to use KongIngress resource.

Let me know if you have further questions.


#3

Hi @hbagdi!
Thanks for more clarifications, but looks like I still lack of information after being read the manuals provided.
So we’ve got Kubernetes Ingress resources with respective Kong Ingress resources extending them. Lets treat and use those as a complement pair.

I’ve got some routes with appropriate methods available:
/s1/v3/a1 [GET, POST]
/s1/v3/a1/([a-zA-Z0-9±_]+)/f1 [GET, PUT]
/s1/v3/a2/ - Any method
I could create:

  • Kubernetes Ingress object with {“path”: “/s1/v3”}.
  • Kong ingress {“proxy”: {“path”: {"/s1/v3"}, “route”: {“methods”: [“GET”, “PUT”, “POST”]}}
    I’ve tried to add the “paths” parameter anywhere to Kong Ingress but with no luck. So I still can’t provide the paths I’ve described above.
    So that also doesn’t provide any possibility to limit methods path-wise, but I couldn’t even add the paths yet.

Thanks in advance!


#4

Hello @megastallman,

Ingress resource in Kubernetes provides you to express routing decision based on Host header and path of your request.
A sample of how you could configure your first rule will be (/s1/v3/a1 [GET, POST]) :

metadata:
  name: my-ingress
  annotations:
    plugins.konghq.com: co
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /s1/v3/a1
        backend:
          serviceName: my-service # will be your service
          servicePort: 80
---
apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  name: my-ingress # not the name is same as the name of the ingress resource
route:
  methods:
  - GET
  - POST

#5

Hi @megastallman did @hbagdi’s comment answer your question? If so, please mark it as the solution by clicking the ticky box button at the bottom of the comment. Thanks!


#6

So, path based routing only is not supported? You need both?


#7

Hello @krimal,

Only path based routing is not yet supported but is very high on our priority list so expect the support to be out soon. Stay tuned!


#8

Hi!
Yes, currently I need only-path-based routing including regex, and method-based. We are currently trying to migrate from AWS api-gateway.


#9

Thanks, this sounds great, we have a use case that depends on it and this is something we really need.

Awesome fast response
BR

Krister


#10

Hello @krimal, @megastallman,

A PR landed in the repository yesterday:

This will allow users to route based on path only in future.
Stay tuned for our next release!


#11

Fantastic!
I’m looking forward to have a try! The host header became a possible kong-show-stopper for us, so, this looks really promising. Looking forward to it.


#12

Great!
I’ll be waiting for. I think the AWS Api-Gateway functionality should have free implementations.


#13

Perfect the 0.2.2 version is working well with regards to using ‘PATH’ only… though will this affect SSL use?


#14

I’m not sure I understand your concern, could you please elaborate?