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

I have created the custom plugin “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)

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.

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.