Added QUARKUS_DATASOURCE_JDBC_ACQUISTION_TIMEOUT as 10s as an environment variable in my Kubernetes deployment though I have been trying various fixes for long time. In my case it was Keycloak version 25.0.6 and using Quarkus framework.
The earlier versions were using Jboss and this fix will not be applicable if the issue exists in older versions.