Kong Community Expose Admin Api — Kubernetes

  • Enable the kong proxy and create a network load balancer — see the kong-proxy service line 572
  • Create the kong service account — line 770
  • Create the postgres db — line 772 onwards
  • Set admin env env within the contain — line 640 onwards
kubectl get pods -n kong
kubectl get svc -n kong
kubectl port-forward svc/kong-admin 8000:8001 -n kong
curl -i POST http://localhost:8080/services \
--data name=admin-api \
--data host=kong-admin \
--data port=8001
curl -i POST http://localhost:8080/services/admin-api/routes \
--data 'paths[]=/admin-api'
export KONG_API=$(kubectl get svc --namespace kong kong-proxy -o jsonpath='{.status.loadBalancer.ingress[*].hostname}')... curl -i GET $KONG_API/admin-api/
curl -i POST \
--url http://localhost:8080/services/admin-api/plugins/ \
--data 'name=key-auth'
curl -i POST \
--url http://localhost:8080/services/admin-api/plugins/ \
--data "name=acl" \
--data "config.whitelist=admin-group" \
--data "config.hide_groups_header=true"
curl -i POST \
--url http://localhost:8080/consumers/ \
--data "username=admin"
curl -i -X POST \
--url http://localhost:8080/consumers/admin/key-auth/ \
--data 'key=CHANGEMETOASUPERSECUREKEY'
curl -i -X POST \
--url http://localhost:8080/consumers/admin/acls \
--data "group=admin-group"
curl -i GET $ADMIN_API/admin-api
curl -i GET $ADMIN_API/admin-api?apikey=CHANGEMETOASUPERSECUREKEY
curl -i GET $KONG_API/admin-api/consumers/admin/acls?apikey=CHANGEMETOASUPERSECUREKEY

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joshua Callis

Joshua Callis

Converted DevOps Engineer, Previously a Senior Software Engineer.