# Kong gateway doesn't start on GKE when using external PostgresDB instance

**URL:** <https://discuss.konghq.com/t/kong-gateway-doesnt-start-on-gke-when-using-external-postgresdb-instance/11352>\
**Category:** General\
**Tags:** kong-gateway\
**Created:** [March 26, 2023, 8:15am UTC](https://discuss.konghq.com/t/kong-gateway-doesnt-start-on-gke-when-using-external-postgresdb-instance/11352 "2023-03-26T08:15:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hgprasad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hgprasad/32/3898_2.png) [@hgprasad](https://discuss.konghq.com/u/hgprasad)\
**Post date:** [March 26, 2023, 8:15am UTC](https://discuss.konghq.com/t/kong-gateway-doesnt-start-on-gke-when-using-external-postgresdb-instance/11352/1 "2023-03-26T08:15:57Z")

</div>

Hi,

I am trying to install kong/kong-gateway (tag 3.1) on GCP GKE K8s cluster with external PostgresDB instance running on GCP with public IP and all SSL settings off. I have bootstrapped Postgres database externally using Virtual machine installed with Kong 3.1 after I got error earlier. (Am I doing this wrong ?? )

Now that I try to install Kong, init pod completes with logs,

% kubectl logs -n kong kong-kong-init-migrations-lrmhc | tail -5  
Database already bootstrapped  
%

but kong pod itself doesn’t come up.  
% kubectl get pods -n kong  
NAME READY STATUS RESTARTS AGE  
kong-kong-64b9984454-crmg4 1/2 CrashLoopBackOff 20 (64s ago) 79m  
kong-kong-init-migrations-lrmhc 0/1 Completed 0 23h  
kong-postgresql-0 0/1 Pending 0 23h

% kubectl logs -n kong kong-kong-64b9984454-crmg4 | tail -20  
Defaulted container “ingress-controller” out of: ingress-controller, proxy, clear-stale-pid (init), wait-for-db (init)  
time=“2023-03-26T08:11:22Z” level=info msg=“diagnostics server disabled”  
time=“2023-03-26T08:11:22Z” level=info msg=“starting controller manager” commit=c6ee6c4828881b374925755f48284fb21f46ef8d logger=setup release=2.8.1 repo=“[GitHub - Kong/kubernetes-ingress-controller: 🦍 Kong for Kubernetes: The official Ingress Controller for Kubernetes.](https://github.com/Kong/kubernetes-ingress-controller.git)”  
time=“2023-03-26T08:11:22Z” level=info msg=“getting enabled options and features” logger=setup  
time=“2023-03-26T08:11:22Z” level=info msg=“getting the kubernetes client configuration” logger=setup  
W0326 08:11:22.901115 1 client\_config.go:618] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.  
time=“2023-03-26T08:11:22Z” level=info msg=“getting the kong admin api client configuration” logger=setup  
Error: unable to build kong api client: looking up workspace: HTTP status 401 (message: “Invalid RBAC credentials”)  
Error: unable to build kong api client: looking up workspace: HTTP status 401 (message: “Invalid RBAC credentials”)  
%

Here is snippet from values.yml used while installing with Helm  
…  
pg\_port: 5432  
pg\_database: kong  
pg\_host:  
valueFrom:  
secretKeyRef:  
key: pg\_host  
name: kong-config-secret  
pg\_password:  
valueFrom:  
secretKeyRef:  
key: pg\_password  
name: kong-config-secret  
pg\_ssl: “off”  
pg\_ssl\_verify: “off”  
pg\_user: kong  
…  
…  
postgresql:  
enabled: false

# auth:

# username: kong

# database: kong

…

Please help me with this setup.

Regards,  
Prasad

---

<div class="post-metadata">

**Author:** ![Sachin\_Ghumbre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/sachin_ghumbre/32/2737_2.png) [@Sachin\_Ghumbre](https://discuss.konghq.com/u/Sachin_Ghumbre)\
**Post date:** [March 30, 2023, 4:26am UTC](https://discuss.konghq.com/t/kong-gateway-doesnt-start-on-gke-when-using-external-postgresdb-instance/11352/2 "2023-03-30T04:26:49Z")

</div>

Hi @hgprasad -

As per error message you mentioned “Invalid RBAC credentials” it looks like error is related to RBAC configurations in the values.yaml.

When we enable RBAC, in the below example it is basic auth, we have to mention below values in the yaml.

```auto
enterprise.rbac.enabled=true 
enterprise.rbac.admin_gui_auth=basic-auth 
enterprise.rbac.session_conf_secret=kong-session-config 

env.password.valueFrom.secretKeyRef.name=kong-enterprise-superuser-password 
env.password.valueFrom.secretKeyRef.key=password 

```

Try with above and see if your error disappears.

---

<div class="post-metadata">

**Author:** ![hgprasad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hgprasad/32/3898_2.png) [@hgprasad](https://discuss.konghq.com/u/hgprasad)\
**Post date:** [April 19, 2023, 2:22pm UTC](https://discuss.konghq.com/t/kong-gateway-doesnt-start-on-gke-when-using-external-postgresdb-instance/11352/3 "2023-04-19T14:22:32Z")

</div>

I tried different approach, i deployed kong on k8s using Helm and inbuilt postgres DB subchart.  
Now I am trying to connect to external PostgresDB instance but I get this error as external DB is not bootstrapped.  
How do I bootstrap it ?

\*\*kubectl logs -n kong quickstart-kong-pre-upgrade-migrations-9g5sq \*\*  
**Error: Cannot run migrations: Database needs bootstrapping or is older than Kong 1.0.**

**To start a new installation from scratch, run ‘kong migrations bootstrap’.**

\*\*To migrate from a version older than 1.0, migrated to Kong 1.5.0 first. \*\*  
**If you still have ‘apis’ entities, you can convert them to Routes and Services**  
**using the ‘kong migrations migrate-apis’ command in Kong 1.5.0.**

I know in docker env we do this, whats the alternate to k8s installation.  
_docker run --rm --name kong-boot \*  
\*\* --network=kong \*_  
\*\* -e “KONG\_DATABASE=postgres” \*\*  
\*\* -e “KONG\_PG\_HOST=kong-database” \*\*  
\*\* kong/kong-gateway:3.0.1.0 \*\*  
\*\* kong migrations bootstrap\*\*

thanks,  
Prasad

---

<div class="post-metadata">

**Author:** ![Sachin\_Ghumbre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/sachin_ghumbre/32/2737_2.png) [@Sachin\_Ghumbre](https://discuss.konghq.com/u/Sachin_Ghumbre)\
**Post date:** [April 27, 2023, 6:37am UTC](https://discuss.konghq.com/t/kong-gateway-doesnt-start-on-gke-when-using-external-postgresdb-instance/11352/4 "2023-04-27T06:37:02Z")

</div>

> [@hgprasad](#):
>
> bootstrap

Please refer attached file and run below command:

kubectl apply -f migrationFile.yml -n YOUR\_NAMESPACE

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/4/49d4305b311dafbb6943b254e1d9931db1da8bad.png)

---

<div class="post-metadata">

**Author:** ![hgprasad](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hgprasad/32/3898_2.png) [@hgprasad](https://discuss.konghq.com/u/hgprasad)\
**Post date:** [April 27, 2023, 3:43pm UTC](https://discuss.konghq.com/t/kong-gateway-doesnt-start-on-gke-when-using-external-postgresdb-instance/11352/5 "2023-04-27T15:43:09Z")

</div>

Thanks for reply,

I did fresh helm install with external PostgresDB and it worked.
