Bootstrap FreeKB - Kong Enterprise Edition (KongEE) - kong health command on OpenShift
Kong Enterprise Edition (KongEE) - kong health command on OpenShift


Let's say your Kong application has been deployed to OpenShift. The oc get pods command can be used to display the kong pods.

oc get pods -n kong

 

Something like this should be returned.

NAME                                  READY   STATUS    RESTARTS   AGE
grafana-0                             2/2     Running   0          27d
kong-1.3.0.2-6c789dccf5-4w5sw         1/1     Running   0          27d
kong-1.3.0.2-6c789dccf5-fc4nr         1/1     Running   0          27d
kong-1.3.0.2-6c789dccf5-n5f45         1/1     Running   0          27d
kong-admin-1.3.0.2-5d7c89d4bb-4gg4g   1/1     Running   0          27d
postgres-67b6d87679-d76d5             1/1     Running   14         27d
prom-0                                4/4     Running   12         27d
redis-574787997b-5jbpv                2/2     Running   6          27d

 

In this example, the kong health command is issued in the kong-1.3.0.2-6c789dccf5-4w5sw pod to determine if Kong is healthy.

oc exec kong-1.3.0.2-6c789dccf5-4w5sw -n kong -- kong health

 

If Kong is healthy, something like this should be returned.

nginx.......running

Kong is healthy at /usr/local/kong

 

If Kong is not healthy, something like this should be returned.

Kong is not running at /usr/local/kong

 

Under the hood, the kong command line tool (/usr/local/bin/kong) is an OpenResty script.

#!/usr/bin/env /usr/local/openresty/bin/resty
setmetatable(_G, nil)
pcall(require, "luarocks.loader")
package.path = (os.getenv("KONG_LUA_PATH_OVERRIDE") or "") .. "./?.lua;./?/init.lua;" .. package.path
require("kong.cmd.init")(arg)

 

This OpenResty script requires kong.cmd.init, which would be a file along the lines of /usr/local/share/lua/5.1/kong/cmd/init.lua. When the kong command is invokes with the "health" flag, this tells the kong/cmd/init.lua file to call the /usr/local/share/lua/5.1/kong/cmd/health.lua file.

The kong/cmd/health.lua file will check if the Kong services are running.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 5d8ed5 in the box below so that we can be sure you are a human.