Custom Plugin not enabled

1. Env

  • Kubernetes
  • Kong(1.3.0) with DB(postgresql) and Ingress(0.5.0)
  • stable chart
  • upload lua file in kong and kong Ingress pod (by configmap)
    loc : /etc/kong/plugins/custom-checker/handler.lua
    /etc/kong/plugins/custom-checker/schema.lua
    /etc/kong/kong.conf

2. kong.conf
plugins = bundled, custom-checker
lua_package_path = /etc/?.lua;/etc/kong/plugins/custom-checker/?.lua;;

3. Enable Plugin with chart
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: custom-checker
labels:
global: ā€œfalseā€
enabled: true
plugin: custom-checker

4. error log in ingress-controller
E0904 13:09:15.395497 1 kong.go:208] error filling in defaults for plugin: custom-checker
E0904 13:09:15.407342 1 controller.go:125] unexpected failure updating Kong configuration:
1 errors occured:
while processing event: {Create} failed: 400 Bad Request {ā€œmessageā€:ā€œschema violation (name: plugin ā€˜custom-checkerā€™ not enabled; add it to the ā€˜pluginsā€™ configuration property)ā€,ā€œnameā€:ā€œschema violationā€,ā€œfieldsā€:{ā€œnameā€:ā€œplugin ā€˜custom-checkerā€™ not enabled; add it to the ā€˜pluginsā€™ configuration propertyā€},ā€œcodeā€:2}

** I also enabled jwt plugin in bundle like this
jwt plugin enable successfully.

Have you changed the plugins property in kong.conf using environment variables or using the the config file?
Also, please ensure that you have changed these variables for all the Kong containers (one in the Admin API container) and another in the regular Kong deployment.

I have the same problem. have you made any progress on this?

@hbagdi May you please elaborate further on how to change plugins property in kong.conf using environment variablesā€¦

Iā€™m running on AKS by the way.

Please set the KONG_PLUGINS environment variable to bundled, custom-checker.
And set the KONG_LUA_PACKAGE_PATH environment variable as well.

Exec into the Kong container and curl the / on Admin interface and make sure that these properties are set correctly.
Also, ensure that the files that are mount using ConfigMap are readable by the user under which the Kong process is running.

Iā€™d also advise you to not mount the plugins at /etc/ but something like /opt/kong.

Once these are all set up correctly, you should be able load the custom plugin and enable them using Kong Ingress Controller.

Thank you for your quick response and your time.
I tried it as you told me and it works fine.
Is it wrong to add configuration to kong.conf?
Or is it a bug inside kong?

This is the procedure I did. I will leave it to help others

values.yaml
env:
kong_plugins: bundled, custom-checker
kong_lua_package_path: /etc/?.lua;/etc/kong/plugins/custom-checker/?.lua;;

kong.conf
#lua_package_path = /etc/?.lua;/etc/kong/plugins/custom-checker/?.lua;;
#plugins = bundled, custom-checker

changed files
deployment.yaml // for kong
_helpers.tpl // for ingress-controller
controller-deployment.yaml // for kong-admin

  • name: KONG_PLUGINS
    value: {{ .Values.env.kong_plugins }}
  • name: KONG_LUA_PACKAGE_PATH
    value: {{ .Values.env.kong_lua_package_path }}
1 Like

Hi @hbagdi
I read your advise again.
Why we should mount plugins /opt?
kong.conf file mount /etc/kong.conf
Please let me know why the location of plugin is ā€œ/optā€?

Just as a general practice /etc directory doesnā€™t have any code defined but should have configuration in it.

Mounting it in /etc is also okay but make sure to not step over /etc/kong/kong.conf, the default path for Kongā€™s configuration.