Dynamic Service routing based on JWT using Kong & Kubernetes

I would like to use Kong in my kubernetes cluster. I was going through the documentation and found that Kong is extensible through plugin extensions. But, based on documentation it seems plugins only get executed after routing (and ** associated service **) is matched. I would need Kong customization before this step.

My use case is once a route is matched, I would like to find the service based on some values in JWT token. Is it doable with Kong ?


Yes, you could do this through a custom plugin and upstreams. Kong matches services to upstreams based on the host configured on the service but you can override this. So, in your scenario you would attach your custom plugin to your service/route (depending on the level of granularity you want), allow Kong to match the route and run your plugin and then, in your plugin you override the upstream based on the value in your JWT token (or whatever). See https://docs.konghq.com/1.0.x/pdk/kong.service/#kongserviceset_upstreamhost

Correct, Kong can do this using a custom plugin and using the PDK function as mentioned by @onematchfox.