KongIngress doesn't work for me

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+

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.

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!

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

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!

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

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!

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

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

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!

2 Likes

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.

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

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

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

I have an exact same scenario, to handle to replace the AWS API Gateway.
@hbagdi , Does this configuration still the best for the scenario as described by @megastallman, If yes, this means having a lot of configurations to achieve the requirement.
OR we have a better way evolved recently.

This is the way to do it since the Ingress resource in k8s doesn’t support routing by methods.
I’m not sure if I understand the concern of lot of configuration. You can also share KongIngress resource across ingress resources if they have the same property.
Could you elaborate?

Just found KongIngress CRD doesn’t support algorithm property.

algorithm property was added in Kong 1.3 and is set to be included in Kong Ingress Controller 0.6:

Also, please do not cross post in multiple places, it leads to communication and notification overhead, which doesn’t help any of us.

In previous kong version (up to kong1.1 as fa as i remember) the association between Ingress and KongIngress based on the same resource name was documented.
Today documentaion mentions only the association based on annotation but I’m running kong1.3 using the association based on same name and it still works.
Could you please confirm this linking option?
If that’s still valid, why is no longer documented?

This is deprecated but it still works. It is an oversight that it is missing from the documentation.