Install Konga on K8S

Even though when running Kong API Gateway in K8S, It's recommended to use the yaml descriptive files to create the routes and services for your applications, you can use the Kong Admin API [3] and the Konga web interface [2] for those tasks. This tutorial shows you how to install Konga on your K8S cluster using helm (I based on [1] and added support for pod annotations). All source code and the helm chart used in this tutorial are at [0].

Prerequisites:

- You have the master role in your K8S cluster to install new applications, create ingresses, etc.

- Kong API Gateway (Kong Ingress Controller) has been installed on your K8S cluster and in the kong namespace

- You have full privileges to create a new Postgres database for your Konga

Install Konga on K8S:

1. Create the Postgres DB for your Konga

CREATE USER konga;
CREATE DATABASE konga OWNER konga;
ALTER USER konga WITH PASSWORD <your secret>;

2. Prepare the values.yaml file

Update the values.yaml with these following information

config: {}
  port: 1337
  node_env: <development or production>
  db_adapter: postgres
  db_host: <address of your postgres db host>
  db_port: 5432
  db_user: konga
  db_password: <postgres password>
  db_database: konga

and

runMigrations: true

3. Install Konga helm chart

helm install konga ./ -n kong -f values.yaml

4. Expose Konga using ingress 

Prepare the ingress.yaml file as following

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: konga-ingress
  namespace: kong
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: konga.yourdomain.com
    http:
      paths:
      - path: "/"
        pathType: Prefix
        backend:
          service:
            name: konga
            port:
              number: 80

Run kubectl to create the ingress

kubectl apply -f ingress.yaml

Now you can access Konga at konga.yourdomain.com.

References:

[0] https://github.com/dangtrinhnt/konga-helm-chart

[1] https://github.com/bennu/charts/tree/main/charts/konga

[2] https://github.com/pantsel/konga

[3] https://docs.konghq.com/gateway-oss/2.4.x/admin-api/

Comments