# Apply custom plugin via KongIngress

**URL:** <https://discuss.konghq.com/t/apply-custom-plugin-via-kongingress/2698>\
**Category:** Questions\
**Tags:** service-mesh, kubernetes\
**Created:** [January 25, 2019, 8:19pm UTC](https://discuss.konghq.com/t/apply-custom-plugin-via-kongingress/2698 "2019-01-25T20:19:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![traines](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/traines/32/158_2.png) [@traines](https://discuss.konghq.com/u/traines)\
**Post date:** [January 30, 2019, 7:44pm UTC](https://discuss.konghq.com/t/apply-custom-plugin-via-kongingress/2698/2 "2019-01-30T19:44:07Z")

</div>

Custom plugins can be added to the ingress controller via volume mounts and environment variable configuration. Note that these need to be added to both the [kong Deployment](https://github.com/Kong/kubernetes-ingress-controller/blob/0.3.0/deploy/single/all-in-one-postgres.yaml#L637-L641) and the ingress-kong Deployment, as the ingress controller uses a split deployment with separate Kong nodes for the admin API and proxy.

You’ll need to first create a [configMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) to hold your plugin source with something like `kubectl create configmap custom-plugins --from-file=/path/to/kong-plugin-hello/ --namespace kong` .

After, the volume configuration in the Kong deployment will look something like:

```auto
        image: kong:1.0.2-centos
        volumeMounts:
          - name: custom-plugin-vol
            mountPath: /kong-plugins/kong/plugins/
        env:
          - name: KONG_LUA_PACKAGE_PATH
            value: "/kong-plugins/?.lua;;"
          - name: KONG_CUSTOM_PLUGINS
            value: hello-world

      volumes:
        - name: custom-plugin-vol
          configMap:
            name: custom-plugins
            items:
              - key: handler.lua
                path: hello-world/handler.lua
              - key: schema.lua
                path: hello-world/schema.lua

```

With that deployed, you can add Ingress objects normally, with annotations to load the plugin and specify configuration as you would with any standard plugin.

Note that there are some caveats to updating ConfigMaps that you’ll need to take into account pending Kubernetes feature requests:

> <https://github.com/kubernetes/kubernetes/issues/22368>

  

> <https://github.com/kubernetes/kubernetes/issues/24957>

You can alternately build a custom Docker image, starting from one of the standard Kong images and copying the plugin files over. The environment variables should still be added, but the volumeMounts/configMaps can be removed.

---

_[View the full topic](https://discuss.konghq.com/t/apply-custom-plugin-via-kongingress/2698)._
