在 Kubernetes 上设置 Rundeck - 无法连接到 Postgres 数据库



我是Kubernetes的新手,正在尝试在上面设置Rundeck(3.3.5(。映像已正确安装。然而,当我在AWS RDS上添加Postrges数据库时,它无法连接到它。不过,我可以使用DBeaver使用相同的URL和端口号连接到数据库。以下是错误和yaml的详细信息。我们非常感谢在这方面提供的任何帮助。

错误:

[2020-10-29T19:02:47,013] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
java.sql.SQLException: Driver:org.postgresql.Driver@18918d70 returned null for URL:jdbc:postgres://xxx.amazonaws.com:5432/RUNDECK
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:338) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:744) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:676) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[tomcat-jdbc-9.0.31.jar!/:?]
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:412) ~[spring-jdbc-5.1.18.RELEASE.jar!/:5.1.18.RELEASE]

Yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: rundeck
name: test-rundeck
namespace: testops
spec:
replicas: 1
strategy: {}
selector:
matchLabels:
app: rundeck
template:
metadata:     
labels:
app: rundeck
spec:
containers:
- env:        
- name: JVM_MAX_RAM_PERCENTAGE
value: "75"
- name: RUNDECK_GRAILS_URL
value: http://xxx.us-east-1.elb.amazonaws.com:4440/rundeck
- name: RUNDECK_SERVER_CONTEXTPATH
value: /rundeck
- name: RUNDECK_DATABASE_URL
value: jdbc:postgres://xxx.us-east-1.rds.amazonaws.com:5432/RUNDECK
- name: RUNDECK_DATABASE_DRIVER
value: org.postgresql.Driver
- name: RUNDECK_DATABASE_USERNAME
value: postgres
- name: RUNDECK_DATABASE_PASSWORD
value: postgres123
image: rundeck/rundeck:3.3.5-20201019
imagePullPolicy: Always
name: rundeck
resources:
limits:
memory: 1Gi    
volumeMounts:
- mountPath: "/opt/test/mnt"
name: testops-pv
volumes:
- name: testops-pv
persistentVolumeClaim:
claimName: testops-pvc    
restartPolicy: Always
status: {}

问题

jdbc:postgresurl不正确。

解决方案

正如这里提到的和@MegaDrive68k在评论中提到的,您应该使用jdbc:postgresql而不是jdbc:postgres

有关于这方面的简要文档。

最新更新