一、应用管理-Helm

1.1 添加Chart仓库

1、添加名为bitnami的chart仓库,链接为https://charts.bitnami.com/bitnami

image-20250112141341570

image-20250112141636401

2、查看状态,观察到已经变为Active

image-20250112141732024

二、使用Helm安装Redis

1、依次点击【应用】-【Chart】,搜索redis

image-20250112142631870

2、这里选择版本为18.19.2后,点击【安装】

image-20250112143431376

3、勾选【在安装前自定义Helm选项】后,点击【下一步】

image-20250112143536340

4、因为是演示,需要将某些配置设置为false。设置完成后点击【下一步】

...
...
auth:
  enabled: false
  existingSecret: ''
  existingSecretPasswordKey: ''
  password: ''
  sentinel: false
...
...
  persistence:
    accessModes:
      - ReadWriteOnce
    annotations: {}
    dataSource: {}
    enabled: false
...
...

最终配置如下:

architecture: replication
auth:
  enabled: false
  existingSecret: ''
  existingSecretPasswordKey: ''
  password: ''
  sentinel: false
  usePasswordFileFromSecret: false
  usePasswordFiles: false
clusterDomain: cluster.local
commonAnnotations: {}
commonConfiguration: |-
  # Enable AOF https://redis.io/topics/persistence#append-only-file
  appendonly yes
  # Disable RDB persistence, AOF persistence already enabled.
  save ""
commonLabels: {}
diagnosticMode:
  args:
    - infinity
  command:
    - sleep
  enabled: false
existingConfigmap: ''
extraDeploy: []
fullnameOverride: ''
global:
  compatibility:
    openshift:
      adaptSecurityContext: disabled
  imagePullSecrets: []
  imageRegistry: ''
  redis:
    password: ''
  storageClass: ''
image:
  debug: true
  digest: ''
  pullPolicy: IfNotPresent
  pullSecrets: []
  registry: registry.cn-hangzhou.aliyuncs.com
  repository: abroad_images/redis
  tag: 7.2.4-debian-12-r9
kubeVersion: ''
kubectl:
  command:
    - /opt/bitnami/scripts/kubectl-scripts/update-master-label.sh
  image:
    digest: ''
    pullPolicy: IfNotPresent
    pullSecrets: []
    registry: docker.io
    repository: bitnami/kubectl
    tag: 1.29.2-debian-12-r3
  resources:
    limits: {}
    requests: {}
master:
  affinity: {}
  args: []
  automountServiceAccountToken: false
  command: []
  configuration: ''
  containerPorts:
    redis: 6379
  containerSecurityContext:
    allowPrivilegeEscalation: false
    capabilities:
      drop:
        - ALL
    enabled: true
    readOnlyRootFilesystem: false
    runAsGroup: 0
    runAsNonRoot: true
    runAsUser: 1001
    seLinuxOptions: null
    seccompProfile:
      type: RuntimeDefault
  count: 1
  customLivenessProbe: {}
  customReadinessProbe: {}
  customStartupProbe: {}
  disableCommands:
    - FLUSHDB
    - FLUSHALL
  dnsConfig: {}
  dnsPolicy: ''
  enableServiceLinks: true
  extraEnvVars: []
  extraEnvVarsCM: ''
  extraEnvVarsSecret: ''
  extraFlags: []
  extraVolumeMounts: []
  extraVolumes: []
  hostAliases: []
  initContainers: []
  kind: StatefulSet
  lifecycleHooks: {}
  livenessProbe:
    enabled: true
    failureThreshold: 5
    initialDelaySeconds: 20
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 5
  minReadySeconds: 0
  nodeAffinityPreset:
    key: ''
    type: ''
    values: []
  nodeSelector: {}
  persistence:
    accessModes:
      - ReadWriteOnce
    annotations: {}
    dataSource: {}
    enabled: false
    existingClaim: ''
    labels: {}
    medium: ''
    path: /data
    selector: {}
    size: 8Gi
    sizeLimit: ''
    storageClass: ''
    subPath: ''
    subPathExpr: ''
  persistentVolumeClaimRetentionPolicy:
    enabled: false
    whenDeleted: Retain
    whenScaled: Retain
  podAffinityPreset: ''
  podAnnotations: {}
  podAntiAffinityPreset: soft
  podLabels: {}
  podSecurityContext:
    enabled: true
    fsGroup: 1001
    fsGroupChangePolicy: Always
    supplementalGroups: []
    sysctls: []
  preExecCmds: []
  priorityClassName: ''
  readinessProbe:
    enabled: true
    failureThreshold: 5
    initialDelaySeconds: 20
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 1
  resources: {}
  resourcesPreset: none
  schedulerName: ''
  service:
    annotations: {}
    clusterIP: ''
    externalIPs: []
    externalTrafficPolicy: Cluster
    extraPorts: []
    internalTrafficPolicy: Cluster
    loadBalancerClass: ''
    loadBalancerIP: ''
    loadBalancerSourceRanges: []
    nodePorts:
      redis: ''
    ports:
      redis: 6379
    sessionAffinity: None
    sessionAffinityConfig: {}
    type: ClusterIP
  serviceAccount:
    annotations: {}
    automountServiceAccountToken: false
    create: true
    name: ''
  shareProcessNamespace: false
  sidecars: []
  startupProbe:
    enabled: false
    failureThreshold: 5
    initialDelaySeconds: 20
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 5
  terminationGracePeriodSeconds: 30
  tolerations: []
  topologySpreadConstraints: []
  updateStrategy:
    type: RollingUpdate
metrics:
  command: []
  containerPorts:
    http: 9121
  containerSecurityContext:
    allowPrivilegeEscalation: false
    capabilities:
      drop:
        - ALL
    enabled: true
    readOnlyRootFilesystem: false
    runAsGroup: 0
    runAsNonRoot: true
    runAsUser: 1001
    seLinuxOptions: null
    seccompProfile:
      type: RuntimeDefault
  customLivenessProbe: {}
  customReadinessProbe: {}
  customStartupProbe: {}
  enabled: false
  extraArgs: {}
  extraEnvVars: []
  extraVolumeMounts: []
  extraVolumes: []
  image:
    digest: ''
    pullPolicy: IfNotPresent
    pullSecrets: []
    registry: docker.io
    repository: bitnami/redis-exporter
    tag: 1.58.0-debian-12-r4
  livenessProbe:
    enabled: true
    failureThreshold: 5
    initialDelaySeconds: 10
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  podAnnotations:
    prometheus.io/port: '9121'
    prometheus.io/scrape: 'true'
  podLabels: {}
  podMonitor:
    additionalEndpoints: []
    additionalLabels: {}
    enabled: false
    honorLabels: false
    interval: 30s
    metricRelabelings: []
    namespace: ''
    podTargetLabels: []
    port: metrics
    relabellings: []
    sampleLimit: false
    scrapeTimeout: ''
    targetLimit: false
  prometheusRule:
    additionalLabels: {}
    enabled: false
    namespace: ''
    rules: []
  readinessProbe:
    enabled: true
    failureThreshold: 3
    initialDelaySeconds: 5
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 1
  redisTargetHost: localhost
  resources: {}
  resourcesPreset: none
  service:
    annotations: {}
    clusterIP: ''
    enabled: true
    externalTrafficPolicy: Cluster
    extraPorts: []
    loadBalancerClass: ''
    loadBalancerIP: ''
    loadBalancerSourceRanges: []
    ports:
      http: 9121
    type: ClusterIP
  serviceMonitor:
    additionalEndpoints: []
    additionalLabels: {}
    enabled: false
    honorLabels: false
    interval: 30s
    metricRelabelings: []
    namespace: ''
    podTargetLabels: []
    port: http-metrics
    relabellings: []
    sampleLimit: false
    scrapeTimeout: ''
    targetLimit: false
  startupProbe:
    enabled: false
    failureThreshold: 5
    initialDelaySeconds: 10
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
nameOverride: ''
nameResolutionThreshold: 5
nameResolutionTimeout: 5
namespaceOverride: ''
networkPolicy:
  allowExternal: true
  allowExternalEgress: true
  enabled: true
  extraEgress: []
  extraIngress: []
  ingressNSMatchLabels: {}
  ingressNSPodMatchLabels: {}
  metrics:
    allowExternal: true
    ingressNSMatchLabels: {}
    ingressNSPodMatchLabels: {}
pdb:
  create: false
  maxUnavailable: ''
  minAvailable: 1
podSecurityPolicy:
  create: false
  enabled: false
rbac:
  create: false
  rules: []
replica:
  affinity: {}
  args: []
  automountServiceAccountToken: false
  autoscaling:
    enabled: false
    maxReplicas: 11
    minReplicas: 1
    targetCPU: ''
    targetMemory: ''
  command: []
  configuration: ''
  containerPorts:
    redis: 6379
  containerSecurityContext:
    allowPrivilegeEscalation: false
    capabilities:
      drop:
        - ALL
    enabled: true
    readOnlyRootFilesystem: false
    runAsGroup: 0
    runAsNonRoot: true
    runAsUser: 1001
    seLinuxOptions: null
    seccompProfile:
      type: RuntimeDefault
  customLivenessProbe: {}
  customReadinessProbe: {}
  customStartupProbe: {}
  disableCommands:
    - FLUSHDB
    - FLUSHALL
  dnsConfig: {}
  dnsPolicy: ''
  enableServiceLinks: true
  externalMaster:
    enabled: false
    host: ''
    port: 6379
  extraEnvVars: []
  extraEnvVarsCM: ''
  extraEnvVarsSecret: ''
  extraFlags: []
  extraVolumeMounts: []
  extraVolumes: []
  hostAliases: []
  initContainers: []
  kind: StatefulSet
  lifecycleHooks: {}
  livenessProbe:
    enabled: true
    failureThreshold: 5
    initialDelaySeconds: 20
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 5
  minReadySeconds: 0
  nodeAffinityPreset:
    key: ''
    type: ''
    values: []
  nodeSelector: {}
  persistence:
    accessModes:
      - ReadWriteOnce
    annotations: {}
    dataSource: {}
    enabled: false
    existingClaim: ''
    labels: {}
    medium: ''
    path: /data
    selector: {}
    size: 8Gi
    sizeLimit: ''
    storageClass: ''
    subPath: ''
    subPathExpr: ''
  persistentVolumeClaimRetentionPolicy:
    enabled: false
    whenDeleted: Retain
    whenScaled: Retain
  podAffinityPreset: ''
  podAnnotations: {}
  podAntiAffinityPreset: soft
  podLabels: {}
  podManagementPolicy: ''
  podSecurityContext:
    enabled: true
    fsGroup: 1001
    fsGroupChangePolicy: Always
    supplementalGroups: []
    sysctls: []
  preExecCmds: []
  priorityClassName: ''
  readinessProbe:
    enabled: true
    failureThreshold: 5
    initialDelaySeconds: 20
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 1
  replicaCount: 3
  resources: {}
  resourcesPreset: none
  schedulerName: ''
  service:
    annotations: {}
    clusterIP: ''
    externalTrafficPolicy: Cluster
    extraPorts: []
    internalTrafficPolicy: Cluster
    loadBalancerClass: ''
    loadBalancerIP: ''
    loadBalancerSourceRanges: []
    nodePorts:
      redis: ''
    ports:
      redis: 6379
    sessionAffinity: None
    sessionAffinityConfig: {}
    type: ClusterIP
  serviceAccount:
    annotations: {}
    automountServiceAccountToken: false
    create: true
    name: ''
  shareProcessNamespace: false
  sidecars: []
  startupProbe:
    enabled: true
    failureThreshold: 22
    initialDelaySeconds: 10
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  terminationGracePeriodSeconds: 30
  tolerations: []
  topologySpreadConstraints: []
  updateStrategy:
    type: RollingUpdate
secretAnnotations: {}
sentinel:
  annotations: {}
  args: []
  automateClusterRecovery: false
  command: []
  configuration: ''
  containerPorts:
    sentinel: 26379
  containerSecurityContext:
    allowPrivilegeEscalation: false
    capabilities:
      drop:
        - ALL
    enabled: true
    readOnlyRootFilesystem: false
    runAsGroup: 0
    runAsNonRoot: true
    runAsUser: 1001
    seLinuxOptions: null
    seccompProfile:
      type: RuntimeDefault
  customLivenessProbe: {}
  customReadinessProbe: {}
  customStartupProbe: {}
  downAfterMilliseconds: 60000
  enableServiceLinks: true
  enabled: false
  externalMaster:
    enabled: false
    host: ''
    port: 6379
  extraEnvVars: []
  extraEnvVarsCM: ''
  extraEnvVarsSecret: ''
  extraVolumeMounts: []
  extraVolumes: []
  failoverTimeout: 180000
  getMasterTimeout: 90
  image:
    debug: false
    digest: ''
    pullPolicy: IfNotPresent
    pullSecrets: []
    registry: docker.io
    repository: bitnami/redis-sentinel
    tag: 7.2.4-debian-12-r7
  lifecycleHooks: {}
  livenessProbe:
    enabled: true
    failureThreshold: 6
    initialDelaySeconds: 20
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  masterSet: mymaster
  parallelSyncs: 1
  persistence:
    accessModes:
      - ReadWriteOnce
    annotations: {}
    dataSource: {}
    enabled: false
    labels: {}
    medium: ''
    selector: {}
    size: 100Mi
    sizeLimit: ''
    storageClass: ''
  persistentVolumeClaimRetentionPolicy:
    enabled: false
    whenDeleted: Retain
    whenScaled: Retain
  preExecCmds: []
  quorum: 2
  readinessProbe:
    enabled: true
    failureThreshold: 6
    initialDelaySeconds: 20
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 1
  redisShutdownWaitFailover: true
  resources: {}
  resourcesPreset: none
  service:
    annotations: {}
    clusterIP: ''
    createMaster: false
    externalTrafficPolicy: Cluster
    extraPorts: []
    headless:
      annotations: {}
    loadBalancerClass: ''
    loadBalancerIP: ''
    loadBalancerSourceRanges: []
    nodePorts:
      redis: ''
      sentinel: ''
    ports:
      redis: 6379
      sentinel: 26379
    sessionAffinity: None
    sessionAffinityConfig: {}
    type: ClusterIP
  startupProbe:
    enabled: true
    failureThreshold: 22
    initialDelaySeconds: 10
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  terminationGracePeriodSeconds: 30
serviceAccount:
  annotations: {}
  automountServiceAccountToken: false
  create: true
  name: ''
serviceBindings:
  enabled: false
sysctl:
  command: []
  enabled: false
  image:
    digest: ''
    pullPolicy: IfNotPresent
    pullSecrets: []
    registry: docker.io
    repository: bitnami/os-shell
    tag: 12-debian-12-r16
  mountHostSys: false
  resources: {}
  resourcesPreset: none
tls:
  authClients: true
  autoGenerated: false
  certCAFilename: ''
  certFilename: ''
  certKeyFilename: ''
  certificatesSecret: ''
  dhParamsFilename: ''
  enabled: false
  existingSecret: ''
useExternalDNS:
  additionalAnnotations: {}
  annotationKey: external-dns.alpha.kubernetes.io/
  enabled: false
  suffix: ''
useHostnames: true
volumePermissions:
  containerSecurityContext:
    runAsUser: 0
    seLinuxOptions: null
  enabled: false
  image:
    digest: ''
    pullPolicy: IfNotPresent
    pullSecrets: []
    registry: docker.io
    repository: bitnami/os-shell
    tag: 12-debian-12-r16
  resources: {}
  resourcesPreset: none

5、点击【安装】,等待启动即可

image-20250112144631280

image-20250112151811220

6、点击【工作负载】-【Pod】,观察到pod都已成功建立

image-20250112185736273

7、打开终端,执行命令进行测试

I have no name!@redis-18-1736676485-master-0:/$ redis-cli     
127.0.0.1:6379> set a 1
OK
127.0.0.1:6379> get a
"1"

image-20250112185958462