I tried to deploy keycloak with POSTGRESQL on openshift. I used this image, jboss/keycloak-openshift
image for keycloak and rhscl/postgresql-95-rhel7
for postgresql.
I then I added environment variables in keycloak deployment
I thought this is what I needed to do to make keycloak work with postgresql. These are the errors and warning I am seeing in the pod logs.
IOException occurred while connecting to postgres:5432: java.net.UnknownHostException: postgres
Connection error: : org.postgresql.util.PSQLException: The connection attempt failed.
But it is not working this way. The keycloak pod fails. Do I need to do anything else as well?
What is the name of your database service?
If not the default of postgres
that Keycloak expects, you need to set DB_ADDR
. I use the following in my template:
{
"name": "KEYCLOAK_USER",
"value": "${KEYCLOAK_USER}"
},
{
"name": "KEYCLOAK_PASSWORD",
"value": "${KEYCLOAK_PASSWORD}"
},
{
"name": "DB_VENDOR",
"value": "postgres"
},
{
"name": "DB_ADDR",
"value": "${KEYCLOAK_NAME}-db"
},
{
"name": "DB_PORT",
"value": "5432"
},
{
"name": "DB_DATABASE",
"value": "keycloak"
},
{
"name": "DB_USER",
"value": "keycloak"
},
{
"name": "DB_PASSWORD",
"value": "${DATABASE_PASSWORD}"
},
Suggest setting them all.
Further details in:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.