I am running rke2 cluster and deployed postgresql container with its cluster-ip service on port 5432 and now trying to deploy keycloak container within same cluster however, keycloak pod logs shows:
cannot resolve host “postgresql”; lookup postgresql on 10.23.0.05:53: no such host
my keycloak config in keycloak deployment yaml file:
KC_DB: “postgres”
KC_DB_URL: “jdbc:postgresql://localhost:5432/keycloak”
KC_DB_USERNAME: “*****”
KC_DB_PASSWORD: “****”
KC_DB_URL_DATABASE: “keycloak”
I have tried with different values in KC_DB_URL but still not working, not sure what causing this?
rke2 coredns service is working fine.
Am I missing something here?
@djordje , I am not using docker, I am deploying keycloak using yaml file, it uses containerd not docker to create the containers in rke2 kubernetes cluster.
I tried to use your config specially, still same error:
@ThoreKr , yes there is a clusterIP service running for postgresqDB on port 5432, I did not get you when you said container runtime environment is irrevelvant for this?
to make it more clear, let me rephrase the issue here: I am deploying postgresql and keycloak container image via kubernetes deployment yaml files on RKE2 cluster. of course, both (postgresql and keycloak) are on different pods .i.e different contianers.
It looks like Keycloak unable to resolve the DNS hostname, not sure, what I need to do ?
I tried this putting the postgresql service name (even with port and without port 5432) in keycloak deployment file in the format of “jdbc:postgresql://keycloak-postgres-svc/keycloak”, it was errored out:
"cannot resolve host “postgresql”: lookup postgresql on 10.43.0.10:53: no such host
Do you think it is issue with coreDNS as I just found it one of coreDNS is working but not coreDNS is not working as I have two CoreDNS pod in my rke2 cluster
@ThoreKr , so what should be configuration from JDBC url if you think configuration has not applied correctly.
It feels like no issue with JDBC config, may be it is related to underlying core DNS. have you tried yourself for setting up keycloak and postgresql on kubernetes cluster?
We are using the codecentric keycloakx chart to deploy it.
Can you share the entire deployment configuration, some configuration parameter seems to be either ignored or overwritten. The jdbc url says a different host to what the log says it was trying to resolve. So it can’t be coredns, as the request is already incorrect.
My assumptions would be:
multiple database parameters are specified and overriding each other
some mixup between configuration parameters before build optimization.