简体   繁体   English

openshift上的keycloak和postgresql

[英]keycloak and postgresql on openshift

I tried to deploy keycloak with POSTGRESQL on openshift. 我试图在openshift上用POSTGRESQL部署keycloak。 I used this image, jboss/keycloak-openshift image for keycloak and rhscl/postgresql-95-rhel7 for postgresql. 我使用此映像,将jboss/keycloak-openshift映像用于keycloak,将rhscl/postgresql-95-rhel7用于postgresql。

I then I added environment variables in keycloak deployment 然后,我在keycloak部署中添加了环境变量

  • DB_DATABASE : keycloak DB_DATABASE:密钥斗篷
  • DB_USER : postgresl-secret-database-user DB_USER:postgresl-秘密数据库用户
  • DB_PASSWORD : postgresl-secret-database-password DB_PASSWORD:postgresl-秘密数据库密码
  • DB_VENDOR : POSTGRES DB_VENDOR:POSTGRES

I thought this is what I needed to do to make keycloak work with postgresql. 我认为这是使keycloak与postgresql一起工作所需要做的。 These are the errors and warning I am seeing in the pod logs. 这些是我在pod日志中看到的错误和警告。

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 . 如果不是Keycloak期望的默认postgres ,则需要设置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: 更多详细信息,请参见:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM