"Failed to connect to database" --> Unable to connect to Azure PostgreSQL DB from Keycloak(AKS)

639 views Asked by At

While deploying keycloak in Azure Kubernetes Service using Codecentric Helm Chart, it is unable to connect to Azure PostgreSQL Database.

After pulling the repository in my local machine, made below mentioned changes in the statefulset.yaml file: -

env:
  - name: DB_VENDOR
    value: postgres
  - name: JDBC_PARAMS
    value: "true"
  - name: DB_ADDR
    value: {{ .Values.postgresql.postgresqlDbhost | quote }}
  - name: DB_PORT
    value: {{ .Values.postgresql.service.port | quote  }}
  - name: DB_DATABASE
    value: {{ .Values.postgresql.postgresqlDatabase | quote }}
  - name: DB_USER
    value: {{ .Values.postgresql.postgresqlUsername | quote }}
  - name: DB_PASSWORD
    value: {{ .Values.postgresql.postgresqlPassword | quote }}
  - name: JDBC_PARAMS
    value: "ssl=false"

and provide below mentioned values in values.yaml file

postgresql:
  # If `true`, the Postgresql dependency is enabled
  enabled: false
  # PostgreSQL DB Host to Connect
  postgresqlDbhost: blabladb.postgres.database.azure.com
  # PostgreSQL User to create
  postgresqlUsername: someuser@keyclockdb
  # PostgreSQL Password for the new user
  postgresqlPassword: !*blabla*!
  # PostgreSQL Database to create
  postgresqlDatabase: blabladb
  # Postgressqlport
  service:
    port: 5432

I have disable the Enforce SSL Connection in Azure for testing purposes. Then, after deploying the helm chart from the local(local PC) repository, getting the below mentioned error: -

Warning Snippet

Error Snippet

Please advise on what would be the cause for this issue.

0

There are 0 answers