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

10/29/2020

I am new to Kubernetes, and trying to set up Rundeck (3.3.5) on it. The image has been installed correctly. However when I added a Postrges database on AWS RDS, it's unable to connect to it. I am able to connect to the database by using the same URL and port number with DBeaver though. Below is the detailed information of the Error and the yaml. Any help in this regard is highly appreciated.

Error:

[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: {}
-- android.1215
driver
kubernetes
postgresql
rundeck
yaml

1 Answer

11/2/2020

Issue

The jdbc:postgres url is incorrect.

Solution

As mentioned here and mentioned by @MegaDrive68k in the comments you should use jdbc:postgresql instead of jdbc:postgres.

There is rundeck documentation about that.

-- Jakub
Source: StackOverflow