Redis Cluster Operator creates and manages Redis Clusters atop Kubernetes.
Redis Cluster Operator creates and manages Redis Clusters atop Kubernetes.
Redis Cluster Operator manages Redis Cluster atop Kubernetes.
The operator itself is built with the Operator framework.
Each master node and its slave nodes is managed by a statefulSet, create a headless svc for each statefulSet, and create a clusterIP service for all nodes.
Each statefulset uses PodAntiAffinity to ensure that the master and slaves are dispersed on different nodes. At the same time, when the operator selects the master in each statefulset, it preferentially select the pod with different k8s nodes as master.
Customize the number of master nodes and the number of replica nodes per master
Password
Safely Scaling the Redis Cluster
Backup and Restore
Persistent Volume
Custom Configuration
Prometheus Discovery
Register the DistributedRedisCluster and RedisClusterBackup custom resource definition (CRD).
$ kubectl create -f deploy/crds/redis.kun_distributedredisclusters_crd.yaml
$ kubectl create -f deploy/crds/redis.kun_redisclusterbackups_crd.yamlA namespace-scoped operator watches and manages resources in a single namespace, whereas a cluster-scoped operator watches and manages resources cluster-wide. You can chose run your operator as namespace-scoped or cluster-scoped.
// cluster-scoped
$ kubectl create -f deploy/service_account.yaml
$ kubectl create -f deploy/cluster/cluster_role.yaml
$ kubectl create -f deploy/cluster/cluster_role_binding.yaml
$ kubectl create -f deploy/cluster/operator.yaml
// namespace-scoped
$ kubectl create -f deploy/service_account.yaml
$ kubectl create -f deploy/namespace/role.yaml
$ kubectl create -f deploy/namespace/role_binding.yaml
$ kubectl create -f deploy/namespace/operator.yamlAdd Helm repository
helm repo add ucloud-operator https://ucloud.github.io/redis-cluster-operator/
helm repo updateInstall chart
helm install --generate-name ucloud-operator/redis-cluster-operatorVerify that the redis-cluster-operator is up and running:
$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
redis-cluster-operator 1/1 1 1 1dNOTE: Only the redis cluster that use persistent storage(pvc) can recover after accidental deletion or rolling update.Even if you do not use persistence(like rdb or aof), you need to set pvc for redis.
$ kubectl apply -f deploy/example/redis.kun_v1alpha1_distributedrediscluster_cr.yamlVerify that the cluster instances and its components are running.
…Increase the masterSize to trigger the scaling up.
apiVersion: redis.kun/v1alpha1
kind: DistributedRedisCluster
metadata:
annotations:
# if your operator run as cluster-scoped, add this annotations
redis.kun/scope: cluster-scoped
name: example-distributedrediscluster
spec:
# Increase the masterSize to trigger the scaling.
masterSize: 4
ClusterReplicas: 1
image: redis:5.0.4-alpineDecrease the masterSize to trigger the scaling down.
apiVersion: redis.kun/v1alpha1
kind: DistributedRedisCluster
metadata:
annotations:
# if your operator run as cluster-scoped, add this annotations
redis.kun/scope: cluster-scoped
name: example-distributedrediscluster
spec:
# Increase the masterSize to trigger the scaling.
masterSize: 3
ClusterReplicas: 1
image: redis:5.0.4-alpineNOTE: Only Ceph S3 object storage and PVC is supported now
Backup
$ kubectl create -f deploy/example/backup-restore/redisclusterbackup_cr.yamlRestore from backup
$ kubectl create -f deploy/example/backup-restore/restore.yaml$ kubectl create -f deploy/example/prometheus-exporter.yaml$ kubectl create -f deploy/example/custom-password.yaml$ kubectl create -f deploy/example/persistent.yaml$ kubectl create -f deploy/example/custom-config.yaml$ kubectl create -f deploy/example/custom-service.yaml$ kubectl create -f deploy/example/custom-resources.yamlsee e2e
No open issues yet, or sync has not completed.