Installing Kong API Gateway with External Postgres using Helm Chart

325 views Asked by At

I have a Postgres Database running on Kubernetes cluster.

kubectl get po -n kong

NAME                                       READY   STATUS             RESTARTS       AGE
kong-postgres-pod                          1/1     Running            0              31m

kubectl get svc -n kong

NAME                                    TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                         AGE
postgres-kong-service                   ClusterIP      10.233.44.192   <none>        5432/TCP                        38m

Now I want to bind this postgres database with Kong API Gateway, which I am installing using Helm chart.

Helm Installation:

helm repo add kong https://charts.konghq.com 

helm repo update 

helm install kong-with-postgres --namespace kong kong/kong \
   --set ingressController.installCRDs=false \
   --set env.database=postgres \
   --set admin.enabled=true \
   --set admin.http.enabled=true \
   --set env.pg_host=postgres-kong-service.kong.svc.cluster.local \
   --set env.pg_user=postgres \
   --set env.pg_password=kong \
   --set env.pg_port=5432 \
   --set env.pg_database=postgres

It creates two more pods as shown below:

kubectl get po -n kong

NAME                                            READY   STATUS             RESTARTS      AGE
kong-with-postgres-kong-5486bb5774-n2cfs        0/2     Init:1/2           0             3m4s
kong-with-postgres-kong-init-migrations-g78tv   0/1     CrashLoopBackOff   4 (63s ago)   3m4s
kong-postgres-pod                               1/1     Running            0             28m

Below are the logs for these PODs:

kubectl logs -f kong-with-postgres-kong-init-migrations-g78tv -n kong

Error: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: connection refused

Run with --v (verbose) or --vv (debug) for more details

kubectl logs -f kong-with-postgres-kong-5486bb5774-n2cfs -n kong

Defaulted container "ingress-controller" out of: ingress-controller, proxy, clear-stale-pid (init), wait-for-db (init)
Error from server (BadRequest): container "ingress-controller" in pod "kong-with-postgres-kong-5486bb5774-n2cfs" is waiting to start: PodInitializing

What value should I set for env.pg_host ?

What's wrong with my helm parameters?

Any help would be highly appreciated.

0

There are 0 answers