OT-CONTAINER-KIT / redis-operator

A golang based redis operator that will make/oversee Redis standalone/cluster/replication/sentinel mode setup on top of the Kubernetes.
https://ot-redis-operator.netlify.app/
Apache License 2.0
793 stars 217 forks source link

Redis Replication service pointing to read-only replica #629

Open diptripa opened 1 year ago

diptripa commented 1 year ago

What version of redis operator are you using?

redis-operator version: 0.15

Does this issue reproduce with the latest release? Yes

What operating system and processor architecture are you using (kubectl version)?

kubectl version Output
1.25.11

What did you do?

  1. Created redis-replication using this manifest:

    ---
    apiVersion: redis.redis.opstreelabs.in/v1beta1
    kind: RedisReplication
    metadata:
    name: redis-replication
    #  annotations:
    #    redis.opstreelabs.in/skip-reconcile: "true"
    spec:
    clusterSize: 5
    kubernetesConfig:
    image: quay.io/opstree/redis:v7.0.5
    imagePullPolicy: IfNotPresent
    resources:
      requests:
        cpu: 200m
        memory: 256Mi
      limits:
        cpu: 200m
        memory: 256Mi
    storage:
    volumeClaimTemplate:
      spec:
        storageClassName: basic-nfs-rwx-retain
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 50Gi
    redisExporter:
    enabled: true
    image: quay.io/opstree/redis-exporter:v1.44.0
    imagePullPolicy: Always
    # env:
    # - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS
    #   value: "true"
    securityContext:
    runAsUser: 1000 
  2. Changed some parameters like storage requests and cpu, memory requests.

  3. Connected to service redis-replication:6379 from app.

What did you expect to see? That it is serving the cache without any issues.

What did you see instead?

15
You can't write against a read only replica.
14
200
13
You can't write against a read only replica.
12
200
11
You can't write against a read only replica.
10
200
9
You can't write against a read only replica.
jwitko commented 12 months ago

Same issue here. It would appear the there is no separate service created that targets the master specifically. It also appears this may be the intentional design and we have to use the sentinel setup to act as a proxy layer for this?

SecretMineDE commented 12 months ago

We have the same issue. A possible solution would be to use some kind of sidecar next to the redis replication containers to change the labels or have the operator do this.

elrondwong commented 10 months ago

Same issue here

aysegulozkaya commented 10 months ago

Same issue. Is there any solution?

shubham-cmyk commented 10 months ago

Didn't get time for this. I would fix this asap. Putting this in the next milestone

elrondwong commented 10 months ago

During concile patch role label of pods