# Custom plugin K8s problem

**URL:** <https://discuss.konghq.com/t/custom-plugin-k8s-problem/7321>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [October 21, 2020, 9:54am UTC](https://discuss.konghq.com/t/custom-plugin-k8s-problem/7321 "2020-10-21T09:54:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zzf1313](https://avatars.discourse-cdn.com/v4/letter/z/d78d45/32.png) [@zzf1313](https://discuss.konghq.com/u/zzf1313)\
**Post date:** [October 21, 2020, 9:54am UTC](https://discuss.konghq.com/t/custom-plugin-k8s-problem/7321/1 "2020-10-21T09:54:35Z")

</div>

we write a new plugin , it is run well in vm .  
we deploy kong and kong ingress control in k8s  
we can find the plugin(available\_on\_server) when we call admin api([http://apigw-in.uat.homecreditcfc.cn:8001/](http://apigw-in.uat.homecreditcfc.cn:8001/))  
And then we create an api with this plugin in service, we deploy it to k8s and could be detected  
we could no find it in admin api  
[http://apigw-in.uat.homecreditcfc.cn:8001/services/serviceid/plugins](http://apigw-in.uat.homecreditcfc.cn:8001/services/serviceid/plugins)

ingress-control display this log(2020/10/21 02:28:23 [warn] 22#0: \*61289 [kong] plugins.lua:126 DEPRECATED: /plugins/schema/:name endpoint is deprecated, please use /schemas/plugins/:name instead., client: 172.30.29.1, server: kong\_admin, request: “GET /plugins/schema/weight-url-param-rewrite HTTP/1.1”, host: “kong-admin:8444”  
172.30.29.1 - - [21/Oct/2020:02:28:23 +0000] “GET /plugins/schema/weight-url-param-rewrite HTTP/1.1” 404 56 “-” “Go-http-client/1.1”)

Could you kindly point out the problem?

Our yaml is as follows

apiVersion: [configuration.konghq.com/v1](http://configuration.konghq.com/v1)  
config:  
query\_string:  
- weight: 10  
param: param=A  
- weight: 90  
param: param=B  
kind: KongPlugin  
metadata:  
name: kongplugin-75f2ce47-228c-4661-a4fb-653cbfeccf94-technical-tool-1-1603267901777  
namespace: technical-tool  
plugin: weight-url-param-rewrite

apiVersion: extensions/v1beta1  
kind: Ingress  
metadata:  
namespace: technical-tool  
name: ingress-route-test1-technical-tool-1-1603267909413  
annotations:  
[konghq.com/override:](http://konghq.com/override:) kongingress-route-test1-technical-tool-1-1603267906535  
[kubernetes.io/ingress.class:](http://kubernetes.io/ingress.class:) kong-uat-internal  
spec:  
rules:  
- host: [apim-mockservice.uat.homecreditcfc.cn](http://apim-mockservice.uat.homecreditcfc.cn)  
http:  
paths:  
- backend:  
servicePort: 80  
serviceName: service-service-test-weight-technical-tool-1-1603267901776  
path: /  
tls:  
- hosts:  
- [apim-mockservice.uat.homecreditcfc.cn](http://apim-mockservice.uat.homecreditcfc.cn)  
secretName: homecreditcfc-cert

apiVersion: [configuration.konghq.com/v1](http://configuration.konghq.com/v1)  
kind: KongIngress  
metadata:  
name: kongingress-service-test-weight-technical-tool-1-1603267904333  
namespace: technical-tool  
proxy:  
path: /  
protocol: http  
connect\_timeout: 60000  
retries: 5  
read\_timeout: 60000  
write\_timeout: 60000  
upstream:  
hash\_on: none  
hash\_fallback: none  
slots: 1000

apiVersion: [configuration.konghq.com/v1](http://configuration.konghq.com/v1)  
kind: KongIngress  
metadata:  
name: kongingress-route-test1-technical-tool-1-1603267906535  
namespace: technical-tool  
route:  
methods:   
regex\_priority: 0  
strip\_path: true  
preserve\_host: false  
protocols:  
- http  
- https

apiVersion: v1  
kind: Service  
metadata:  
name: service-service-test-weight-technical-tool-1-1603267901776  
namespace: technical-tool  
annotations:  
[konghq.com/override:](http://konghq.com/override:) kongingress-service-test-weight-technical-tool-1-1603267904333  
[konghq.com/plugins:](http://konghq.com/plugins:) kongplugin-75f2ce47-228c-4661-a4fb-653cbfeccf94-technical-tool-1-1603267901777  
labels:  
app: service-service-test-weight-technical-tool-1-1603267901776  
spec:  
selector:  
app: mockservice-test-service-api-a  
type: ClusterIP  
ports:  
- protocol: TCP  
port: 80  
name: default  
targetPort: 8080

---

<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:** [October 30, 2020, 12:22am UTC](https://discuss.konghq.com/t/custom-plugin-k8s-problem/7321/2 "2020-10-30T00:22:23Z")

</div>

Which versions of Kong and the ingress controller are you using? Are they [compatible](https://github.com/Kong/kubernetes-ingress-controller/blob/main/docs/references/version-compatibility.md#kong)? That deprecation warning probably shouldn’t appear if they are, though ultimately it’s a warning, not an error.

How did you make the custom plugin available in the Kong containers running in Kubernetes? If you don’t see the custom plugin when hitting the root admin API endpoint of the Kong instance running in Kubernetes, it’s not actually available there.

Since the base image won’t include it, you’ll need to add it somehow before you can instruct the controller to apply it. Typically, that means:

- Building a custom Docker image, i.e. starting from a standard Kong image, using `luarocks install <plugin>` or other means of installing your plugin into it (installing a package you’ve built using your OS package manager or copying Lua code into the filesystem directly), saving that image, and instructing your Kubernetes Deployments to use it.
- [Creating a ConfigMap that contains your custom plugin code and mounting it in your Pods’ Kong containers](https://github.com/Kong/kubernetes-ihttps://github.com/Kong/charts/blob/main/charts/kong/values.yaml#L235-L263ngress-controller/blob/main/docs/guides/setting-up-custom-plugins.md).

Either option is valid, and it’s essentially up to personal preference which you use. The one exception is that you will likely need a custom image if your plugin needs to install additional libraries not present in the base image: there are some limitations with ConfigMap mounts that mean it will usually be much easier to install the plugin and its dependencies into a custom image using LuaRocks.
