如何配置Keycloak头盔图

时间:2020-08-28 20:19:33

标签: kubernetes keycloak kubernetes-helm

我正在尝试将docker-compose.yaml Keycloak转换为Char值,对此我有些犹豫:

Docker-compose配置如下:

{
  "_items": [],
  "_links": {
    "parent": {
      "title": "home",
      "href": "/"
    },
    "self": {
      "title": "people",
      "href": "people"
    }
  },
  "_meta": {
    "page": 1,
    "max_results": 25,
    "total": 0
  }
}

我要使用图表值做什么:

  keycloak:
    container_name: keycloak
    image: jboss/keycloak:10.0.0
    hostname: keycloak
    command:
      [
        '-b',
        '0.0.0.0',
        '-Djboss.socket.binding.port-offset=1000',
        '-Dkeycloak.migration.action=import',
        '-Dkeycloak.migration.provider=dir',
        '-Dkeycloak.migration.dir=/keycloak',
        '-Dkeycloak.migration.strategy=IGNORE_EXISTING',
      ]
    volumes:
      - ./keycloak:/realm-config
    environment:
      KEYCLOAK_USER: admin@example.com
      KEYCLOAK_PASSWORD: password
    networks:
      keycloak:
        aliases:
          - keycloak.localtest.me
    ports:
      - 9080:9080/tcp

我不太了解将docker-compose.yaml中的内容放在哪里:

keycloak:
  basepath: auth
  username: admin
  password: password
  route:
    tls:
      enabled: false
  extraEnv: |
    - name: PROXY_ADDRESS_FORWARDING
      value: "true"
    - name: KEYCLOAK_IMPORT
      value: /keycloak/master-realm.json
    - name: JAVA_OPTS
      value: >-
        -Djboss.socket.binding.port-offset=1000
  extraVolumes: |
    - name: realm-secret
      secret:
        secretName: realm-secret
  extraVolumeMounts: |
    - name: realm-secret
      mountPath: "../keycloak/"
      readOnly: true
  ingress:
    enabled:    true
    annotations:
      kubernetes.io/ingress.class: nginx
      nginx.ingress.kubernetes.io/use-regex: "true"
    path: /auth/?(.*)
    hosts:
      - keycloak.localtest.me

P.S我正在尝试为https://github.com/oauth2-proxy/oauth2-proxy/tree/master/contrib/local-environment运行k8s示例 那里有Dex的k8s演示,我想用Keycloak进行修改。

1 个答案:

答案 0 :(得分:3)

您可以使用kompose工具将docker compose直接转换为kubernetes文件。如果要制作舵图,只需替换为模板并在图表值中提供值即可。另外,Kubernetes部署在yaml中具有命令字段。

您可以在github.com/codecentric/helm-charts/blob/master/charts/keycloak/中看到...。命令由.Values.command

设置。

因此在文件github.com/codecentric/helm-charts/blob/master/charts/keycloak/中…将 command:[] 替换为您的 docker-compose命令