Issues with Installing Custom Plugin in Kong via Helm on Kubernetes

Hello Kong Community,

I’m trying to install a custom plugin in Kong without using a Docker build, specifically using Helm in a Kubernetes environment. I am using Kong version 3.6.1.

What I am trying to do:

I want to add my custom plugin to the Kong Gateway and ensure it is recognized and operational.

What I followed:

I referred to the [Kong documentation] for guidance on how to achieve this. Following the instructions, I was able to successfully create a ConfigMap, which I confirmed by running kubectl get configmaps.

What I checked:

Since I used the kong/ingress Helm chart, I also verified the deployments. The gateway description shows that the KONG_LUA_PACKAGE_PATH is configured correctly as:

/opt/?.lua;/opt/?/init.lua;;

And the KONG_PLUGINS includes:

bundled,my_custom_plugin

Debugging Steps:

I ran the following command to check the contents of the Kong gateway pod:

kubectl exec -it {kong-gateway-pod-name} -n default – /bin/sh

I can see my plugin in the directory /opt/kong/plugins with the command:

ls /opt/kong/plugins

However, I noticed that my plugin is not present in:

ls /usr/local/share/lua/5.1/kong/plugins/

Question:

What could be causing my custom plugin not to appear in /usr/local/share/lua/5.1/kong/plugins/, and how can I resolve this issue? Any insights or troubleshooting tips would be greatly appreciated!

Thank you!

I wanted to share how I managed to get my custom plugin working, even though it wasn’t listed in the /usr/local/share/lua/5.1/kong/plugins/ directory.

My Experience:

Despite my custom plugin not appearing in that directory, it functioned perfectly. Here’s what I found:

1. Plugin Functionality:
The plugin worked fine without being listed in the usual Lua path. This indicates that as long as it’s properly configured and included in the Kong setup, it can still operate as intended.

2. Using Admin API vs. CRDs:

  • When I created the plugin directly via Postman using the Admin API, it registered and listed correctly under https://admin-api-host/plugins/.

  • However, when I created a YAML file for the KongPlugin CRD, it didn’t show up under https://admin-api-host/plugins/ until I associated it with a service or route. This was a crucial step I initially overlooked.

Great that you were able to make it work.

Might be for your upcoming step is to create a custom image with custom plugins included so that you can avoid having such issues with config maps. This will especially be useful if your custom plugin is using external Lua packages.

1 Like