<p>I`m currently using the jboss/keycloak:12.0.4 container within my Kubernetes cluster with a single realm configuration. The configuration file is mounted through an configmap.
The config file currently looks like {...realm1...}. Now I need three more realms and I have <a href="https://stackoverflow.com/questions/61184888/how-to-import-multiple-realm-in-keycloak">read</a>, that I can put multiple realm configs into an array.</p>
<pre><code>[
{...realm1...},
{...realm2...}
]
</code></pre>
<p>Unfortunately this is not working on my side. The containers are crashing and in the logs I get the error message: &quot;Error during startup: java.lang.RuntimeException: Failed to parse json&quot;. I saw that people are adding the option <code>-Dkeycloak.migration.provider=singleFile</code> to their docker commands, but I don't have those for Kubernetes that way. How can i achieve to include multiple realms?</p>

MOE
<p>Since you are using <code>jboss/keycloak:12.0.4</code> I am assuming that you set <code>KEYCLOAK_IMPORT</code> environment variable, right?</p>
<p>The docker container <a href="https://github.com/keycloak/keycloak-containers/blob/12.0.4/server/tools/docker-entrypoint.sh#L71" rel="nofollow noreferrer">maps this environment variable</a> to <code>-Dkeycloak.import=...</code>.</p>
<p>If you want to import multiple realms this way, you may simply want to add each realm into a single file and add them as a comma-seperated list.</p>
<p>So <code>KEYCLOAK_IMPORT=/tmp/realm1.json,/tmp/realm2.json</code> becomes <code>-Dkeycloak.import=/tmp/realm1.json,/tmp/realm2.json</code></p>
<p>For details please see the <a href="https://www.keycloak.org/docs/latest/server_admin/index.html#_export_import" rel="nofollow noreferrer">server administration guide</a> (scroll down to end of chapter <code>Export and Import</code>).</p>
<p>You may also want to checkout <a href="https://github.com/keycloak/keycloak-operator" rel="nofollow noreferrer">Keycloak operator</a> which provides a <a href="https://github.com/keycloak/keycloak-operator/blob/master/deploy/crds/keycloak.org_keycloakrealms_crd.yaml" rel="nofollow noreferrer">CRD for KeycloakRealms</a>.</p>
