Minimal Redis from Operator¶
Very much new workload inside OPenShift / OKD or Kubernetes using Redis as distributed cache or session storage.
To address this there's an operator ( https://ot-container-kit.github.io/redis-operator/ )
It's best to use a real redis cluster. CPU and Memory usage is typically low:
- Top of 0.6 CPU, 0.7 Gig memory and 6 pods
- Average of 0.1 CPU and less than 0.1 Gig memory
All values for a 3 count stateful set.
If you're using 1 Gig storage PVC's you're ending with 6 Gig storage consumption ;-)
Install¶
-
Install the Redis operator like it's mentioned in https://ot-container-kit.github.io/redis-operator/guide/installation.html
-
or use the Operator Tab in OpenShift / OKD
-
or apply this YAML in OpenShift / OKD:
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: redis-operator namespace: openshift-operators spec: channel: stable installPlanApproval: Automatic name: redis-operator source: community-operators sourceNamespace: openshift-marketplace
Usage¶
In your namespace use the following yaml to get a redundant redis cluster.
Pay special attentions to:
- storage size
- storage class (should be block storage for best performance)
apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: RedisCluster
metadata:
name: redis-cluster
spec:
clusterSize: 3
kubernetesConfig:
image: 'quay.io/opstree/redis:v6.2.5'
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 101m
memory: 128Mi
requests:
cpu: 101m
memory: 128Mi
serviceType: ClusterIP
redisExporter:
enabled: false
image: 'quay.io/opstree/redis-exporter:1.0'
redisFollower:
serviceType: ClusterIP
redisLeader:
serviceType: ClusterIP
storage:
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: rook-ceph-block
Von Peter Pfläging vor etwa 3 Jahren aktualisiert · 9 Revisionen