Search code examples
postgresqlkeycloakkubernetes-helm

Keycloak Kubernetes Directory Not Found


I have in my environment keycloak and keycloak postgresql that are deployed using helm charts. Currently have version of keycloak 18.0.2 and wanted to upgrade to keycloak 22.0.5. I changed the helm charts using the ones from github for version 22.0.5, but when I deploy it, it gives the error:

2024-01-17 11:25:52,636 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (development) mode
2024-01-17 11:25:52,637 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: directory not found

The postgresql database works fine, I connected on it and it all looks ok. I even added an environment variable in the statefulset.yml file of the keycloak to change the log level to debug, but it still doesn't throw any other errors apart from the ones above:

- name: KC_LOG_LEVEL
  value: "DEBUG"

I am using the postgresql version 14.4, but I don't believe this should be of impact to keycloak. I have also connected on the keycloak pod when it is starting and I compared multiple directories to the pod from version 18 where it works and couldn't find any difference.

What could the Directory that it is not finding be?


Solution

  • JVM option "keycloak.import" should contain the path to your config. It seems that your error is thrown when that folder is empty:

    File[] files = Paths.get(dir).toFile().listFiles();
    Objects.requireNonNull(files, "directory not found");
    

    You can check if you are passing any variable like "-Dkeycloak.import=/config" when starting keycloak. Make sure that you are passing a folder and not a file.