[keycloak-user] Create users in the imported real using helm

Tony Yip tony.yip at shinetown.com.hk
Mon Jul 22 03:06:53 EDT 2019


Hi Mathew,

According to e35e046 <https://github.com/helm/charts/commit/e35e046cf78c89d800362dd97fbd761d2c892a70> of https://github.com/helm/charts/blob/master/stable/keycloak/templates/configmap.yaml <https://github.com/helm/charts/blob/master/stable/keycloak/templates/configmap.yaml>, the preStartScript is executed (line 20) before the realm is import (line 24). You may import user with realm data.

Tony Yip
Frontend Developer

Shinetown Telecommunication Limited
https://shinetown.com.hk/ <https://shinetown.com.hk/>

> On 22 Jul 2019, at 2:40 PM, Mathew George <mgeorge at dspace.de> wrote:
> 
> Hello,
> 
> I am using keycloak helm charts for installing keycloak in our cluster and I am able to import a custom realm as described in the documentation. Now I want to create some users in this custom realm. I tried using the 'prestartScript'.  See the contents of my value.yaml
> 
> 
>  extraVolumes: |
>    - name: realm-secret
>      secret:
>        secretName: realm-secret
> 
>  extraVolumeMounts: |
>    - name: realm-secret
>      mountPath: "/realm/"
>      readOnly: true
> 
>  extraArgs: -Dkeycloak.import=/realm/realmData.json
> 
>  preStartScript: |
>    /opt/jboss/keycloak/bin/kcadm.sh create users -r MyCustomRealm -s username=admin -s enabled=true;/opt/jboss/keycloak/bin/kcadm.sh set-password -r MyCustomRealm --username admin --new-password admin;
>  enabled: false
> 
> 
> 
> But this is not working. I also tried the following command in the 'preStartScript'. ( This is also not working)
> 
> /opt/jboss/keycloak/bin/add-user-keycloak.sh -r MyCustomRealm -u admin -p admin
> 
> 
> Kindly provide inputs.
> 
> 
> Best regards
> 
> [cid:image001.png at 01D54069.121BC050]
> 
> Mathew George
> Experiment Software ECTA
> 
> dSPACE GmbH
> Rathenaustraße 26
> 33102 Paderborn
> 
> Tel.: +49 5251 1638-507
> Fax: +49 5251 16198-0
> Mail: mgeorge at dspace.de<mailto:mgeorge at dspace.de>
> Web: www.dspace.com<http://www.dspace.com>
> 
> 
> We comply with our obligation to inform you about data protection according to Art. 13-14 of the GDPR by publishing said information on our website. Read our data protection regulations here<https://www.dspace.com/en/pub/home/privacypolicy.cfm>.
> <image001.png>_______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user



More information about the keycloak-user mailing list