Redis Sentinel 的 Redis cli 身份验证超时

Redis cli auth times out for redis sentinel

提问人:Matt_San 提问时间:8/24/2023 更新时间:8/24/2023 访问量:82

问:

我在使用 Redis Sentinel 时遇到了问题。 我部署了 在我的 Kubernetes 环境中,bitnami 提供的带有 Sentinel 的 Redis HA 模式。 直到几天前,一切正常,我可以连接到 sentinel 容器和 redis。从昨天开始,我一直在日志文件中收到此错误,我正在使用的 redis 映像是 docker.io/bitnami/redis:7.0.8-debian-11-r0,而哨兵映像是 docker.io/bitnami/redis-sentinel:7.0.7-debian-11-r1009:04:32.67 INFO ==> about to run the command: REDISCLI_AUTH=$REDIS_PASSWORD timeout 220 redis-cli -h redis.gntn-bacheca-gad.svc.cluster.local -p 26379 sentinel get-master-addr-by-name mymaster

这是我正在使用的生成的 StatefulSet:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-node
  namespace: "gntn-bacheca-gad"
  labels:
    app.kubernetes.io/name: redis
    helm.sh/chart: redis-17.8.0
    app.kubernetes.io/instance: redis
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: node
spec:
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: redis
      app.kubernetes.io/instance: redis
      app.kubernetes.io/component: node
  serviceName: redis-headless
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: redis
        helm.sh/chart: redis-17.8.0
        app.kubernetes.io/instance: redis
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/component: node
      annotations:
        checksum/configmap: 8e45506deb5deafd4cda3e5c947463e9d9b8a9938c48cc0d184adfabb7507449
        checksum/health: fe5ba0c879bdeefc22d3dfe886e8ef4ae9f34c7edc9cf747a6de5d06e1412318
        checksum/scripts: 1dfa44150f64f3c63dfaa9e466197b88f1f47f5281ecef92258d8cd89cbe6987
        checksum/secret: c5f840c872f7859ba66fd5333fe32304ecb92fa071ca93866c8fb318969f4d23
    spec:
      
      securityContext:
        fsGroup: 1001
      serviceAccountName: redis
      affinity:
        podAffinity:
          
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/name: redis
                    app.kubernetes.io/instance: redis
                    app.kubernetes.io/component: node
                topologyKey: kubernetes.io/hostname
              weight: 1
        nodeAffinity:
          
      terminationGracePeriodSeconds: 30
      containers:
        - name: redis
          image: docker.io/bitnami/redis:7.0.8-debian-11-r0
          imagePullPolicy: "IfNotPresent"
          lifecycle:
            preStop:
              exec:
                command:
                  - /bin/bash
                  - -c
                  - /opt/bitnami/scripts/start-scripts/prestop-redis.sh
          securityContext:
            runAsUser: 1001
          command:
            - /bin/bash
          args:
            - -c
            - /opt/bitnami/scripts/start-scripts/start-node.sh
          env:
            - name: BITNAMI_DEBUG
              value: "false"
            - name: REDIS_MASTER_PORT_NUMBER
              value: "6379"
            - name: ALLOW_EMPTY_PASSWORD
              value: "no"
            - name: REDIS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: redis
                  key: redis-password
            - name: REDIS_MASTER_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: redis
                  key: redis-password
            - name: REDIS_TLS_ENABLED
              value: "no"
            - name: REDIS_PORT
              value: "6379"
            - name: REDIS_SENTINEL_TLS_ENABLED
              value: "no"
            - name: REDIS_SENTINEL_PORT
              value: "26379"
            - name: REDIS_DATA_DIR
              value: /data
          ports:
            - name: redis
              containerPort: 6379
          startupProbe:
            failureThreshold: 22
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
            exec:
              command:
                - sh
                - -c
                - /health/ping_liveness_local.sh 5
          livenessProbe:
            initialDelaySeconds: 20
            periodSeconds: 5
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 5
            exec:
              command:
                - sh
                - -c
                - /health/ping_liveness_local.sh 5
          readinessProbe:
            initialDelaySeconds: 20
            periodSeconds: 5
            timeoutSeconds: 1
            successThreshold: 1
            failureThreshold: 5
            exec:
              command:
                - sh
                - -c
                - /health/ping_readiness_local.sh 1
          resources:
            limits: {}
            requests: {}
          volumeMounts:
            - name: start-scripts
              mountPath: /opt/bitnami/scripts/start-scripts
            - name: health
              mountPath: /health
            - name: redis-data
              mountPath: /data
            - name: config
              mountPath: /opt/bitnami/redis/mounted-etc
            - name: redis-tmp-conf
              mountPath: /opt/bitnami/redis/etc
            - name: tmp
              mountPath: /tmp
        - name: sentinel
          image: docker.io/bitnami/redis-sentinel:7.0.7-debian-11-r10
          imagePullPolicy: "IfNotPresent"
          lifecycle:
            preStop:
              exec:
                command:
                  - /bin/bash
                  - -c
                  - /opt/bitnami/scripts/start-scripts/prestop-sentinel.sh
          securityContext:
            runAsUser: 1001
          command:
            - /bin/bash
          args:
            - -c
            - /opt/bitnami/scripts/start-scripts/start-sentinel.sh
          env:
            - name: BITNAMI_DEBUG
              value: "false"
            - name: REDIS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: redis
                  key: redis-password
            - name: REDIS_SENTINEL_TLS_ENABLED
              value: "no"
            - name: REDIS_SENTINEL_PORT
              value: "26379"
          ports:
            - name: redis-sentinel
              containerPort: 26379
          startupProbe:
            failureThreshold: 22
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
            exec:
              command:
                - sh
                - -c
                - /health/ping_sentinel.sh 5
          livenessProbe:
            initialDelaySeconds: 20
            periodSeconds: 5
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 5
            exec:
              command:
                - sh
                - -c
                - /health/ping_sentinel.sh 5
          readinessProbe:
            initialDelaySeconds: 20
            periodSeconds: 5
            timeoutSeconds: 1
            successThreshold: 1
            failureThreshold: 5
            exec:
              command:
                - sh
                - -c
                - /health/ping_sentinel.sh 1
          resources:
            limits: {}
            requests: {}
          volumeMounts:
            - name: start-scripts
              mountPath: /opt/bitnami/scripts/start-scripts
            - name: health
              mountPath: /health
            - name: sentinel-data
              mountPath: /opt/bitnami/redis-sentinel/etc
            - name: redis-data
              mountPath: /data
            - name: config
              mountPath: /opt/bitnami/redis-sentinel/mounted-etc
      volumes:
        - name: start-scripts
          configMap:
            name: redis-scripts
            defaultMode: 0755
        - name: health
          configMap:
            name: redis-health
            defaultMode: 0755
        - name: config
          configMap:
            name: redis-configuration
        - name: sentinel-data
          emptyDir: {}
        - name: redis-tmp-conf
          emptyDir: {}
        - name: tmp
          emptyDir: {}
  volumeClaimTemplates:
    - metadata:
        name: redis-data
        labels:
          app.kubernetes.io/name: redis
          app.kubernetes.io/instance: redis
          app.kubernetes.io/component: node
      spec:
        accessModes:
          - "ReadWriteOnce"
        resources:
          requests:
            storage: "8Gi"

由于它之前工作过,我尝试从 kubernetes 中删除 Pod 并再次安装它们,但问题仍然存在。 这个问题可能是由什么引起的?

Kubernetes Redis 超时 哨兵 redis-sentinel

评论


答: 暂无答案