keycloak高可用部署

木木2年前技术文章1071

添加keycloak应用

rancher应用商店模式添加keycloak仓库地址

rancher应用商店添加bitnami的helm仓库地址

https://charts.bitnami.com/bitnami

chart模式添加keycloak

添加对应chart包

keycloak-9.2.5_jsDHLiSrDK.tgz

安装keycloak

应用商店安装keycloak并且对yaml文件进行自定义

affinity: {}
args: []
auth:
  adminPassword: ''
  adminUser: admin #管理员用户名称,可更改
  createAdminUser: true
  existingSecret: ''
  existingSecretPerPassword: {}
  managementPassword: ''
  managementUser: manager
  tls:
    autoGenerated: false
    enabled: false
    existingSecret: ''
    jksSecret: ''
    keystoreFilename: ''
    keystorePassword: ''
    resources:
      limits: {}
      requests: {}
    truststoreFilename: ''
    truststorePassword: ''
    usePem: false
autoscaling:
  enabled: false
  maxReplicas: 11
  minReplicas: 1
  targetCPU: ''
  targetMemory: ''
cache:
  enabled: false
clusterDomain: cluster.local
command: []
commonAnnotations: {}
commonLabels: {}
configuration: ''
containerPorts:
  http: 8080
  https: 8443
  management: 9990
containerSecurityContext:
  enabled: true
  runAsNonRoot: true
  runAsUser: 1001
customLivenessProbe: {}
customReadinessProbe: {}
customStartupProbe: {}
diagnosticMode:
  args:
    - infinity
  command:
    - sleep
  enabled: false
existingConfigmap: ''
externalDatabase:
  database: bitnami_keycloak
  existingSecret: ''
  existingSecretPasswordKey: ''
  host: ''
  password: ''
  port: 5432
  user: bn_keycloak
extraDeploy: []
extraEnvVars: []
extraEnvVarsCM: ''
extraEnvVarsSecret: ''
extraStartupArgs: ''
extraVolumeMounts: []
extraVolumes: []
fullnameOverride: ''
global:
  imagePullSecrets: []
  imageRegistry: ''
  # 配置存储
  storageClass: ''
  cattle:
    systemProjectId: p-s7jhh
hostAliases: []
image:
  debug: false
  pullPolicy: IfNotPresent
  pullSecrets: []
  registry: docker.io
  repository: bitnami/keycloak
  tag: 18.0.0-debian-10-r6
ingress:
  annotations: {}
  apiVersion: ''
  enabled: false
  extraHosts: []
  extraPaths: []
  extraRules: []
  extraTls: []
  hostname: keycloak.local
  ingressClassName: ''
  path: /
  pathType: ImplementationSpecific
  secrets: []
  selfSigned: false
  servicePort: http
  tls: false
initContainers: []
initdbScripts: {}
initdbScriptsConfigMap: ''
keycloakConfigCli:
  annotations:
    helm.sh/hook: post-install,post-upgrade,post-rollback
    helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
    helm.sh/hook-weight: '5'
  args: []
  backoffLimit: 1
  command: []
  configuration: {}
  containerSecurityContext:
    enabled: true
    runAsNonRoot: true
    runAsUser: 1001
  enabled: false
  existingConfigmap: ''
  extraEnvVars: []
  extraEnvVarsCM: ''
  extraEnvVarsSecret: ''
  extraVolumeMounts: []
  extraVolumes: []
  hostAliases: []
  image:
    pullPolicy: IfNotPresent
    pullSecrets: []
    registry: docker.io
    repository: bitnami/keycloak-config-cli
    tag: 5.2.0-debian-10-r15
  podAnnotations: {}
  podLabels: {}
  podSecurityContext:
    enabled: true
    fsGroup: 1001
  resources:
    limits: {}
    requests: {}
kubeVersion: ''
lifecycleHooks: {}
livenessProbe:
  enabled: true
  failureThreshold: 3
  initialDelaySeconds: 300
  periodSeconds: 1
  successThreshold: 1
  timeoutSeconds: 5
metrics:
  enabled: false
  service:
    annotations:
      prometheus.io/port: '{{ .Values.metrics.service.ports.http }}'
      prometheus.io/scrape: 'true'
    ports:
      http: 9990
  serviceMonitor:
    enabled: false
    honorLabels: false
    interval: 30s
    jobLabel: ''
    labels: {}
    metricRelabelings: []
    namespace: ''
    relabelings: []
    scrapeTimeout: ''
    selector: {}
nameOverride: ''
networkPolicy:
  additionalRules: {}
  allowExternal: true
  enabled: false
nodeAffinityPreset:
  key: ''
  type: ''
  values: []
nodeSelector: {}
pdb:
  create: false
  maxUnavailable: ''
  minAvailable: 1
podAffinityPreset: ''
podAnnotations: {}
podAntiAffinityPreset: soft
podLabels: {}
podManagementPolicy: Parallel
podSecurityContext:
  enabled: true
  fsGroup: 1001
postgresql:
  architecture: standalone
  auth:
    database: bitnami_keycloak
    existingSecret: ''
    password: ''
    username: bn_keycloak
  enabled: true
priorityClassName: ''
proxy: passthrough
rbac:
  create: false
  rules: []
readinessProbe:
  enabled: true
  failureThreshold: 3
  initialDelaySeconds: 30
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 1
replicaCount: 1
resources:
  limits: {}
  requests: {}
schedulerName: ''
service:
  annotations: {}
  clusterIP: ''
  externalTrafficPolicy: Cluster
  extraPorts: []
  loadBalancerIP: ''
  loadBalancerSourceRanges: []
  nodePorts:
    http: ''
    https: ''
  ports:
    http: 80
    https: 443
  sessionAffinity: None
  type: ClusterIP
serviceAccount:
  annotations: {}
  automountServiceAccountToken: true
  create: true
  name: ''
sidecars: []
startupProbe:
  enabled: false
  failureThreshold: 60
  initialDelaySeconds: 30
  periodSeconds: 5
  successThreshold: 1
  timeoutSeconds: 1
terminationGracePeriodSeconds: ''
tolerations: []
topologySpreadConstraints: {}
updateStrategy:
  rollingUpdate: {}
  type: RollingUpdate

配置文件官方参考文档

https://github.com/bitnami/charts/tree/master/bitnami/keycloak/

获取admin用户的password

Plain Text kubectl get secret keycloak -n {namespace}  -o jsonpath='{.data.admin-password}' |base64 -d

配置keycloak

登录后界面如下

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271434342.png

设置中文

如图进行设置

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271436795.png

创建域

鼠标移动到左上角即可以创建域(realm),域是一个隔离的空间,在realm中我们可以创建users和applications。

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271445147.png

创建完成后可以看到我们已经切换到了刚刚创建的域

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271446419.png

创建用户

接下来我们创建一个用户

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271446838.png

输入用户名确定即可

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271451975.png

创建完成后选择到凭据页面为用户添加密码

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202209291623644.png

用户登录

在客户端页面我们可以看到我们这个域的登录链接

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271501069.png

尝试进行登录

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271502650.png

修改密码

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271503607.png

进行配置

https://teamo-md.oss-cn-shanghai.aliyuncs.com/img/202205271503780.png


相关文章

Go 配置文件管理(ini)

Go 配置文件管理(ini)

1、背景ini 文件是 Initialization File 的缩写,即初始化文件,可用于统一管理各项配置。gopkg.in/ini.v1 是地表最强大、最方便和最流行的 Go 语言 INI 文件操...

MS SQL Server partition by 函数实战二 编排考场人员

需求假设有若干已分配准考证号的考生,准考证号示例(01010001)共计8位,前4位为分类号,后4位为分类下的总排序号。现提供考场分配信息EXCEL文件(包括考场编号 、考场名称、考场容纳人数等),希...

Oracle上云找云掣

背景介绍:随着公有云技术成熟、稳定,越来被大中企业接受。自建IDC机房大成本投入终被云的高效方便稳定所替代。企业基于0racle核心的业务系统势必上云,企业面临0racle如何上云,上云后如何保障数据...

mysql表结构对比工具介绍

mysql表结构对比工具介绍

一、AmpNmp.DatabaseCompare工具1、工具特点:优点:比较两个数据库全部表结构的差异,包括表名、存储引擎、字符集、注释的不同,以及每张表中的字段名、数据类型、字符集、默认值、注释的不...

Hive架构图及Hive SQL的执行流程

Hive架构图及Hive SQL的执行流程

1、Hive产生背景MapReduce编程的不便性HDFS上的文件缺少Schema(表名,名称,ID等,为数据库对象的集合)2、Hive是什么Hive的使用场景是什么?基于Hadoop做一些数据清洗啊...

PG的锁(一)

一、表级锁1.1 表级锁模式常见锁模式以及应用场景:ACCESS SHARE :select操作获取该模式锁资源,通常情况下所有只读取不修改表的查询都会获取该模式锁资源ROW SHARE : sele...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。