We are trying to install community plugin Kong Service Virtualization. As I am completely new to kong, I am not able find any solution where detailed installation steps have been given like where and how to add that plugin, how to edit kong.conf etc. Can anyone help me with the issue. Thanks in advance.
Asked
Active
Viewed 2,460 times
2 Answers
3
you can install any plugin in kong using luarocks
For example here is one sample docker file
FROM kong
ENV LUA_PATH /usr/local/share/lua/5.1/?.lua;/usr/local/kong-oidc/?.lua;;
# For lua-cjson
ENV LUA_CPATH /usr/local/lib/lua/5.1/?.so;;
# Install unzip for luarocks, gcc for lua-cjson
RUN yum install -y unzip gcc
RUN luarocks install luacov
here one example of oidc plugin : https://github.com/nokia/kong-oidc
we can install plugin using : luarocks install <plugin name>
build your own custom docker image and use kong image as base docker image.
here whole example working Dockerfile
FROM kong:latest
USER root
RUN apk update && apk add git unzip luarocks
RUN luarocks install kong-oidc
USER kong

Harsh Manvar
- 27,020
- 6
- 48
- 102
-
Tried the same using Kong Service Virtualization plugin but getting this error when running a new container nginx: [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 – DevSay Jun 05 '20 at 10:42
-
running kong and postgre sql on ? – Harsh Manvar Jun 05 '20 at 11:06
-
running kong and postgre sql using docker or docker compose ? – Harsh Manvar Jun 05 '20 at 11:16
-
1Followed these steps for installation https://docs.konghq.com/install/docker/ – DevSay Jun 05 '20 at 11:19
-
https://gist.github.com/pantsel/73d949774bd8e917bfd3d9745d71febf – Harsh Manvar Jun 05 '20 at 12:07
1
Here is an example of the Dockerfile I use for install the kong-oidc plugin with dependencies:
FROM kong:2.0.2-alpine
USER root
ENV KONG_PLUGINS=bundled,oidc
# Add libs
ADD lib/resty/openidc.lua /usr/local/openresty/lualib/resty/openidc.lua
# Add oidc plugin
ADD plugins/oidc /usr/local/share/lua/5.1/kong/plugins/oidc
# Install dependencies
RUN luarocks install lua-resty-http
RUN luarocks install lua-resty-session
RUN luarocks install lua-resty-jwt 0.2.2
USER kong
I'm adding the oidc plugin from my source code instead luarocks because the repository is unmaintained, and you will need to update some dependencies to make it work.
If you need a functional example of Kong + OpenID + Keycloak, check this repository and this article.

Diego Rojas
- 237
- 5
- 11