Configuring Kong Plugins

Hi,

I am running Kong Databaseless on Kubernetes using the Kong Ingress Controller (version 0.4.0). I’m attempting to configure a plugin with an Ingress route, and am having trouble. I am able to deploy both the Ingress route and the Plugin, however they do not appear to be finding each other.

I have the plugin as so:
apiVersion: configuration.konghq.com/v1
config:
allowed_payload_size: 50
kind: KongPlugin
metadata:
name: request-size-limiting
plugin: request-size-limiting

(for some reason the reformatted text isn’t working for the plugin, just assume that it has been properly formatted as a yaml file)

and the corresponding Ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: kong
    plugins.konghq.com: request-size-limiting
  name: test
spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: test
          servicePort: http
        path: /test-service

I have also temporarily exposed the admin api for testing purposes. I can access the service, but I don’t see the plugin at <admin_api>/routes/<route_id>/plugins.

Any help would be appreciated,
Thanks,
Arnav

You need to have the Ingress and KongPlugin resource defined in the same namespace.
It seems like you are creating he Ingress in test namespace while the KongPlugin resource in default namespace.

Hey,

They should both be running in the default namespace, I found that I was trying to tie a plugin that isn’t installed in the cluster. I tried following the documentation, and am attempting to modify the Kong image to include the plugin (rather than constructing a kubernetes configmap).

I ran luarocks make, added plugins = bundled, [plugin-name] in the kong image, changed the yaml to use the modified kong image, and added the environment variables:

    - name: KONG_LUA_PACKAGE_PATH
      value: "/usr/local/share/lua/5.1/?.lua;;"
    - name: KONG_CUSTOM_PLUGINS
      value: [plugin-name]

However when I access the admin api, I can’t find the plugin enabled on the cluster. Is there a step that I am missing?

Thanks,
Arnav

For anyone having the same issue:

I figured out that the plugin that I was using was quite outdated by looking at the proxy container’s logs. After updating the plugin’s lua files the plugin loaded as expected.

I also did not rename the kong.conf.default file to kong.conf. That held me up for a while as well.

Thanks for the help!
Arnav