Kong container can't reach the external host postgres

Hi everyoneI would like to share some doubt that I have with you.

I am trying to deploy kong from their latest helm chart version
I also want to use kong.env parameters in order to reference a mapping of my postgres secrets value instead of apply directly the values in the command. I mean, this way:

kong:
  env:
     pg_user: kong
     pg_password:
       valueFrom:
         secretKeyRef:
            key: kong
            name: postgres

Before to deploy the chart, I have created manually the kong postgres secrets of this way:

apiVersion: v1
kind: Secret
metadata:
  name: zcrm-kong-secrets
  namespace: kong
type: Opaque
data:
  username: <my-encoded-username-value>
  password: <my-encoded-password-value>
  host: <my-encoded-host-value>
  database: <my-encoded-database-name-value>

So this is my helm command to deploy the chart … (I have a doubt here if I am setting correctly the secretes value in secretKeyRef)

⟩ helm install --name kong stable/kong --version 0.17.0 --set ingressController.enabled=true,proxy.loadBalancerIP=<my-ipV4-address>,image.pullPolicy=Always,postgresql.enabled=false,env.database=postgres,kong.env.pg_user.valueFrom.secretKeyRef.key=username,kong.env.pg_user.valueFrom.secretKeyRef.name=zcrm-kong-secrets,kong.env.pg_password.valueFrom.secretKeyRef.key=password,kong.env.pg_password.valueFrom.secretKeyRef.name=zcrm-kong-secrets,kong.env.pg_host.valueFrom.secretKeyRef.key=host,kong.env.pg_host.valueFrom.secretKeyRef.name=zcrm-kong-secrets,kong.env.pg_database.valueFrom.secretKeyRef.key=database,kong.env.pg_database.valueFrom.secretKeyRef.name=zcrm-kong-secrets --namespace kong

Everything looks ok, but when I check the pods status, they are in Init status, but looks like they are waiting for the db.

I have checked the pod/kong-kong-controller-c9d755c86-f4q8x logs and I get this:

kubectl logs pod/kong-kong-controller-c9d755c86-f4q8x -n kong  -c wait-for-db

Run with --v (verbose) or --vv (debug) for more details
waiting for db
Error: [PostgreSQL error] failed to retrieve server_version_num: connection refused

Does it look like the Kong container can’t reach postgres at the host that I have defined?
I have a doubt with the way in I am mapping the secrets value in the helm install command above.

Someone know what could be happening?

I solved the communication with my external host postgres. I had an error, in the way like I was referencing the secrets.

I was calling kong.env.pg_user.valueFrom.secretKeyRef.key=..
and I have to use is
env.pg_user.valueFrom.secretKeyRef.key=..

it means I have to remove kong parameter at the beggining.

My helm command is:

helm install --name kong stable/kong --version 0.17.0 --set ingressController.enabled=true,proxy.loadBalancerIP=<ipv4value>,image.pullPolicy=Always,postgresql.enabled=false,env.database=postgres,env.pg_user.valueFrom.secretKeyRef.key=username,env.pg_user.valueFrom.secretKeyRef.name=zcrm-kong-secrets,env.pg_password.valueFrom.secretKeyRef.key=password,env.pg_password.valueFrom.secretKeyRef.name=zcrm-kong-secrets,env.pg_host.valueFrom.secretKeyRef.key=host,env.pg_host.valueFrom.secretKeyRef.name=zcrm-kong-secrets,env.pg_database.valueFrom.secretKeyRef.key=database,env.pg_database.valueFrom.secretKeyRef.name=zcrm-kong-secrets --namespace kong

Now, the logs on the migrations pod are these

k logs pod/kong-kong-init-migrations-l4fr8 -n kong
Database already bootstrapped

But is weird, that the other pods, (kong and kong-ingress-controller) are not being started, even are elapsed 8min.

I have deleted the helm chart and I installed it again and everything was OK.

So, the correct helm install command was:

helm install --name kong stable/kong --version 0.17.0 --set ingressController.enabled=true,proxy.type=LoadBalancer,proxy.loadBalancerIP=<my-ipV4-address>,image.pullPolicy=Always,postgresql.enabled=false,env.database=postgres,env.pg_user.valueFrom.secretKeyRef.key=username,env.pg_user.valueFrom.secretKeyRef.name=zcrm-kong-secrets,env.pg_password.valueFrom.secretKeyRef.key=password,env.pg_password.valueFrom.secretKeyRef.name=zcrm-kong-secrets,env.pg_host.valueFrom.secretKeyRef.key=host,env.pg_host.valueFrom.secretKeyRef.name=zcrm-kong-secrets,env.pg_database.valueFrom.secretKeyRef.key=database,env.pg_database.valueFrom.secretKeyRef.name=zcrm-kong-secrets --namespace kong

© 2018 Kong Inc.    Terms  •  Privacy  •  FAQ