azure Keycloak无法导入服务器

kzmpq1sx  于 2023-10-22  发布在  其他
关注(0)|答案(1)|浏览(109)

在我的keycloak values.yaml中,我已经挂载了我的服务器,并使用了一个镜像。但我在密钥斗篷日志里看到的错误是

ERROR: duplicate key value violates unique constraint "uk_b71cjlbenv945rb6gcon438at"
  Detail: Key (realm_id, client_id)=(walter, account-console) already exists

在我的博客中,我看到了错误,

duplicate key value violates unique constraint "uk_b71cjlbenv945rb6gcon438at"
2023-09-29 15:49:58 UTC-6516f21f.73e80-DETAIL:  Key (realm_id, client_id)=(walter, account-console) already exists.
2023-09-29 15:49:58 UTC-6516f21f.73e80-STATEMENT:  insert into public.CLIENT (ALWAYS_DISPLAY_IN_CONSOLE, BASE_URL, BEARER_ONLY, CLIENT_AUTHENTICATOR_TYPE, CLIENT_ID, CONSENT_REQUIRED, DESCRIPTION, DIRECT_ACCESS_GRANTS_ENABLED, ENABLED, FRONTCHANNEL_LOGOUT, FULL_SCOPE_ALLOWED, IMPLICIT_FLOW_ENABLED, MANAGEMENT_URL, NAME, NODE_REREG_TIMEOUT, NOT_BEFORE, PROTOCOL, PUBLIC_CLIENT, REALM_ID, REGISTRATION_TOKEN, ROOT_URL, SECRET, SERVICE_ACCOUNTS_ENABLED, STANDARD_FLOW_ENABLED, SURROGATE_AUTH_REQUIRED, ID) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26)

我在keycloak数据库中检查了我的表,没有这样的领域记录“沃尔特”
我的values.yml文件是

extraVolumes: |
      - name: realm-config
        configMap:
          name: realm-config
          defaultMode: 0755
      - name: keycloak-postgres-configuration-script
        configMap:
          name: keycloak-postgres-configuration-script
          defaultMode: 0755
    
    extraVolumeMounts: |
      - name: realm-config
        mountPath: "/realm/init-realm/"
    
    
    extraInitContainers: |
      - name: init-postgres-configuration
        image: postgres:12.11
        command:
          - /bin/bash
          - -c
          - |
            PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER -d $POSTGRES_DB -f /tmp/postgres-records.sql
        volumeMounts:
            - name: keycloak-postgres-configuration-script
              mountPath: /tmp
        env:
          - name: POSTGRES_HOST
            value: "xxxxxxxxxxxxxxxx"
          - name: POSTGRES_PASSWORD
            value: "xxxxxx"
          - name: POSTGRES_PORT
            value: "5432"   
          - name: POSTGRES_USER
            value: "abc@xxxxxx"
          - name: POSTGRES_DB
            value: "abc_db" 
    
    extraEnv: |
      - name: PROXY_ADDRESS_FORWARDING
        value: "true"
      - name: DB_VENDOR
        value: postgres
      - name: DB_ADDR
        value: "xxxxxxxxx"
      - name: DB_PORT
        value: "5432"
      - name: DB_DATABASE
        value: "xxxxxxx"
      - name: DB_USER
        value: "xxxxxxx"
      - name: DB_PASSWORD
        value: "xxxxxx"
      - name: KEYCLOAK_USER
        value: admin
      - name: KEYCLOAK_PASSWORD
        value: admin
      - name: KEYCLOAK_IMPORT
        value: /realm/init-realm/abc-realm.json
    
    postgresql:
      enabled: false
    
    ingress:
      .....
webghufk

webghufk1#

上面的配置是正确的,但是当我试图通过额外的init容器创建keycloak DB时,我在我的Azure postgres中看到有两个授权正在发生,并且都试图添加相应的领域。所以我创建了一个脚本来创建keycloak DB和用户。在我安装密钥斗篷之前。
此外,在部署密钥斗篷和导入领域时,请确保-

  • 你的keycloak数据库应该是空的(因为即使keycloak导入领域失败,它也会在其中创建相应的表和一些条目。他们可能会阻止你)

相关问题