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:
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.
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.
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!
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.
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?
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?