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

Setting up Rundeck on Kubernetes - Can't connect to the Postgres database

我是 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:postgres url 不正确。

解决方案

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

关于那个有 rundeck documentation