1- # redis-operator
1+ # redis-cluster- operator
22
33## Overview
44
@@ -8,10 +8,39 @@ The operator itself is built with the [Operator framework](https://github.com/op
88
99![ Redis Cluster atop Kubernetes] ( /static/redis-cluster.png )
1010
11+ Each master node and its slave nodes is managed by a statefulSet, create a headless svc for each statefulSet,
12+ and create a clusterIP service for all nodes.
13+
14+ Each statefulset uses PodAntiAffinity to ensure that the master and slaves are dispersed on different nodes.
15+ At the same time, when the operator selects the master in each statefulset, it preferentially select the pod
16+ with different k8s nodes as master.
17+
18+ Table of Contents
19+ =================
20+
21+ * [ redis-cluster-operator] ( #redis-cluster-operator )
22+ * [ Overview] ( #overview )
23+ * [ Prerequisites] ( #prerequisites )
24+ * [ Features] ( #features )
25+ * [ Quick Start] ( #quick-start )
26+ * [ Deploy redis cluster operator] ( #deploy-redis-cluster-operator )
27+ * [ Deploy a sample Redis Cluster] ( #deploy-a-sample-redis-cluster )
28+ * [ Scaling Up the Redis Cluster] ( #scaling-up-the-redis-cluster )
29+ * [ Scaling Down the Redis Cluster] ( #scaling-down-the-redis-cluster )
30+ * [ Backup and Restore] ( #backup-and-restore )
31+ * [ Prometheus Discovery] ( #prometheus-discovery )
32+ * [ Create Redis Cluster with password] ( #create-redis-cluster-with-password )
33+ * [ Persistent Volume] ( #persistent-volume )
34+ * [ Custom Configuration] ( #custom-configuration )
35+ * [ Custom Service] ( #custom-service )
36+ * [ Custom Resource] ( #custom-resource )
37+ * [ ValidatingWebhook] ( #validatingwebhook )
38+ * [ End to end tests] ( #end-to-end-tests )
39+
1140## Prerequisites
1241
1342* go version v1.13+.
14- * Access to a Kubernetes v1.13.3 cluster.
43+ * Access to a Kubernetes v1.13.10 cluster.
1544
1645## Features
1746
@@ -29,7 +58,6 @@ The operator itself is built with the [Operator framework](https://github.com/op
2958
3059- __ Prometheus Discovery__
3160
32-
3361## Quick Start
3462
3563### Deploy redis cluster operator
@@ -76,33 +104,41 @@ NAME MASTERSIZE STATUS AGE
76104example-distributedrediscluster 3 Scaling 11s
77105
78106$ kubectl get all -l redis.kun/name=example-distributedrediscluster
79- NAME READY STATUS RESTARTS AGE
80- pod/drc-example-distributedrediscluster-0 1/1 Running 0 4m5s
81- pod/drc-example-distributedrediscluster-1 1/1 Running 0 3m31s
82- pod/drc-example-distributedrediscluster-2 1/1 Running 0 2m54s
83- pod/drc-example-distributedrediscluster-3 1/1 Running 0 2m20s
84- pod/drc-example-distributedrediscluster-4 1/1 Running 0 103s
85- pod/drc-example-distributedrediscluster-5 1/1 Running 0 62s
86-
87- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
88- service/example-distributedrediscluster ClusterIP None <none> 6379/TCP,16379/TCP 4m5s
89-
90- NAME READY AGE
91- statefulset.apps/drc-example-distributedrediscluster 6/6 4m5s
107+ NAME READY STATUS RESTARTS AGE
108+ pod/drc-example-distributedrediscluster-0-0 1/1 Running 0 2m48s
109+ pod/drc-example-distributedrediscluster-0-1 1/1 Running 0 2m8s
110+ pod/drc-example-distributedrediscluster-1-0 1/1 Running 0 2m48s
111+ pod/drc-example-distributedrediscluster-1-1 1/1 Running 0 2m13s
112+ pod/drc-example-distributedrediscluster-2-0 1/1 Running 0 2m48s
113+ pod/drc-example-distributedrediscluster-2-1 1/1 Running 0 2m15s
114+
115+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
116+ service/example-distributedrediscluster ClusterIP 172.17.132.71 <none> 6379/TCP,16379/TCP 2m48s
117+ service/example-distributedrediscluster-0 ClusterIP None <none> 6379/TCP,16379/TCP 2m48s
118+ service/example-distributedrediscluster-1 ClusterIP None <none> 6379/TCP,16379/TCP 2m48s
119+ service/example-distributedrediscluster-2 ClusterIP None <none> 6379/TCP,16379/TCP 2m48s
120+
121+ NAME READY AGE
122+ statefulset.apps/drc-example-distributedrediscluster-0 2/2 2m48s
123+ statefulset.apps/drc-example-distributedrediscluster-1 2/2 2m48s
124+ statefulset.apps/drc-example-distributedrediscluster-2 2/2 2m48s
92125
93126$ kubectl get distributedrediscluster
94127NAME MASTERSIZE STATUS AGE
95128example-distributedrediscluster 3 Healthy 4m
96129```
97130
98- #### Scaling the Redis Cluster
131+ #### Scaling Up the Redis Cluster
99132
100- Increase the masterSize to trigger the scaling.
133+ Increase the masterSize to trigger the scaling up .
101134
102135```
103136apiVersion: redis.kun/v1alpha1
104137kind: DistributedRedisCluster
105138metadata:
139+ annotations:
140+ # if your operator run as cluster-scoped, add this annotations
141+ redis.kun/scope: cluster-scoped
106142 name: example-distributedrediscluster
107143spec:
108144 # Increase the masterSize to trigger the scaling.
@@ -111,8 +147,29 @@ spec:
111147 image: redis:5.0.4-alpine
112148```
113149
150+ #### Scaling Down the Redis Cluster
151+
152+ Decrease the masterSize to trigger the scaling down.
153+
154+ ```
155+ apiVersion: redis.kun/v1alpha1
156+ kind: DistributedRedisCluster
157+ metadata:
158+ annotations:
159+ # if your operator run as cluster-scoped, add this annotations
160+ redis.kun/scope: cluster-scoped
161+ name: example-distributedrediscluster
162+ spec:
163+ # Increase the masterSize to trigger the scaling.
164+ masterSize: 3
165+ ClusterReplicas: 1
166+ image: redis:5.0.4-alpine
167+ ```
168+
114169#### Backup and Restore
115170
171+ ** Only Ceph object storage is supported now**
172+
116173Backup
117174```
118175$ kubectl create -f deploy/example/backup-restore/redisclusterbackup_cr.yaml
@@ -147,7 +204,7 @@ $ kubectl create -f deploy/example/persistent.yaml
147204$ kubectl create -f deploy/example/custom-config.yaml
148205```
149206
150- #### Custom Headless Service
207+ #### Custom Service
151208
152209```
153210$ kubectl create -f deploy/example/custom-service.yaml
@@ -157,4 +214,12 @@ $ kubectl create -f deploy/example/custom-service.yaml
157214
158215```
159216$ kubectl create -f deploy/example/custom-resources.yaml
160- ```
217+ ```
218+
219+ ## ValidatingWebhook
220+
221+ see [ ValidatingWebhook] ( /hack/webhook/README.md )
222+
223+ ## End to end tests
224+
225+ see [ e2e] ( /test/e2e/README.md )
0 commit comments