# Deploying Kong Custom Plugin in the Kong ingress COntroller + AKS + postgres

**URL:** <https://discuss.konghq.com/t/deploying-kong-custom-plugin-in-the-kong-ingress-controller-aks-postgres/6350>\
**Category:** General\
**Tags:** service-mesh\
**Created:** [May 21, 2020, 12:06pm UTC](https://discuss.konghq.com/t/deploying-kong-custom-plugin-in-the-kong-ingress-controller-aks-postgres/6350 "2020-05-21T12:06:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaiswar.vipin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/jaiswar.vipin/32/1873_2.png) [@jaiswar.vipin](https://discuss.konghq.com/u/jaiswar.vipin)\
**Post date:** [May 21, 2020, 12:06pm UTC](https://discuss.konghq.com/t/deploying-kong-custom-plugin-in-the-kong-ingress-controller-aks-postgres/6350/1 "2020-05-21T12:06:23Z")

</div>

I have created the custom plugin “[https://medium.com/swlh/creating-and-installing-custom-lua-plugins-in-kong-ce7fd64d33bf](https://medium.com/swlh/creating-and-installing-custom-lua-plugins-in-kong-ce7fd64d33bf)” using this reference, and we are successfully able to build and deploy the plugin in KONG 2.0 using docker image.

Reference : [How enable Kong Ingress CUSTOM PLUGIN on k8s (AKS)](https://discuss.konghq.com/t/how-enable-kong-ingress-custom-plugin-on-k8s-aks/4375)

Now we are trying to deploy the same plugin in the KONG as ingress controller (we are using AKS) but i am facing issue

what we had did till now

- Created the configMap and successfully able to describe it by following above steps

\*Now we are trying to deploy the same plugin but facing if we follow the above steps and deployment file looks like

# deployment.yaml

apiVersion: apps/v1  
kind: Deployment  
metadata:  
name: kong-ingress-custom-plugin  
namespace: konga-test  
spec:  
selector:  
matchLabels:  
app: konga-test  
template:  
metadata:  
name: kong-ingress-custom-plugin  
labels:  
app: kong-ingress-custom-plugin  
spec:  
containers:  
- name: proxy  
env:  
- name: KONG\_PLUGINS  
value: ‘bundled,cutom-auth’  
- name: KONG\_LUA\_PACKAGE\_PATH  
value: /opt/?.lua;;  
volumeMounts:  
- name: kong-plugin-cutom-auth  
mountPath: /opt/kong/plugins/cutom-auth  
volumes:  
- defaultMode: 755  
- name: kong-plugin-cutom-auth  
configMap:  
name: kong-plugin-cutom-auth

**we are executing the same below command to apply the change**

> kubectl apply -f miniorange-auth-deployment.yaml --validate=false

**and error we got**

> The Deployment “kong-plugin-miniorange-auth” is invalid: spec.template.spec.containers[0].image: Required value

Here i don’t understand, if we created the ConfigMap for same plugin then why its asking for docker image.

Kindly assist.

Thanks & Regards  
Jaiswar Vipin Kumar R.

---

<div class="post-metadata">

**Author:** ![jaiswar.vipin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/jaiswar.vipin/32/1873_2.png) [@jaiswar.vipin](https://discuss.konghq.com/u/jaiswar.vipin)\
**Post date:** [May 21, 2020, 12:06pm UTC](https://discuss.konghq.com/t/deploying-kong-custom-plugin-in-the-kong-ingress-controller-aks-postgres/6350/2 "2020-05-21T12:06:40Z")

</div>

After **updating** the YAML finally custom pluing get install but after that got next issue. Now same POD, Deployment and Replicaset throwing “ **CrashloopOff** ”. After checking the log of the pod we got following error.

> init\_by\_lua error: /usr/local/share/lua/5.1/kong/init.lua:389: [PostgreSQL error] failed to retrieve PostgreSQL server\_version\_num: connection refused stack traceback:

Kindly assist, where and what i am doing wrong.

**However Updated YAML is**

> apiVersion: apps/v1  
> kind: Deployment  
> metadata:  
> name: kong-ingress-custom-plugin  
> namespace: konga-test  
> spec:  
> selector:  
> matchLabels:  
> app: konga-test  
> replicas: 1  
> template:  
> metadata:  
> name: kong-ingress-custom-plugin  
> labels:  
> app: kong-ingress-custom-plugin  
> spec:  
> containers:  
> name: proxy  
> **image: ‘kong:2.0’**  
> volumeMounts:  
> - name: kong-plugin-custom-auth  
> mountPath: /opt/kong/plugins/kong-plugin-custom-auth  
> - env:  
> - name: KONG\_PG\_DATABASE  
> value: kong  
> - name: KONG\_PG\_HOST  
> value: postgres  
> - name: KONG\_PG\_PORT  
> value: ‘5432’  
> - name: KONG\_PG\_PASSWORD  
> value: kong  
> - name: KONG\_PG\_USER  
> value: kong  
> - name: KONG\_LOG\_LEVEL  
> value: info  
> - name: KONG\_PLUGINS  
> value: ‘bundled,kong-plugin-custom-auth’  
> - name: KONG\_LUA\_PACKAGE\_PATH  
> value: /etc/?./opt/?.lua;;  
> volumes:  
> - defaultMode: 755  
> - name: kong-plugin-custom-auth  
> configMap:  
> name: kong-plugin-custom-auth

Thanks & Regards  
Jaiswar Vipin Kumar R.
