Minimal Redis from Operator » Historie » Zyklus 7
Peter Pfläging, 11.04.2022 09:04
1 | 1 | Peter Pfläging | # Minimal Redis from Operator |
---|---|---|---|
2 | |||
3 | Very much new workload inside OPenShift / OKD or Kubernetes using Redis as distributed cache or session storage. |
||
4 | |||
5 | 2 | Peter Pfläging | To address this there's an operator (https://ot-container-kit.github.io/redis-operator/) |
6 | 1 | Peter Pfläging | |
7 | 7 | Peter Pfläging | It's best to use a real redis cluster. CPU and Memory usage is typically low: |
8 | 4 | Peter Pfläging | |
9 | - Top of 0.6 CPU, 0.7 Gig memory and 6 pods |
||
10 | - Average of 0.1 CPU and less than 0.1 Gig memory |
||
11 | |||
12 | All values for a 3 count stateful set. |
||
13 | |||
14 | If you're using 1 Gig storage PVC's you're ending with 6 Gig storage consumption ;-) |
||
15 | |||
16 | ## Install |
||
17 | |||
18 | - Install the Redis operator like it's mentioned in https://ot-container-kit.github.io/redis-operator/guide/installation.html |
||
19 | - or use the Operator Tab in OpenShift / OKD |
||
20 | - or apply this YAML in OpenShift / OKD: |
||
21 | |||
22 | 5 | Peter Pfläging | ```yaml |
23 | 4 | Peter Pfläging | apiVersion: operators.coreos.com/v1alpha1 |
24 | kind: Subscription |
||
25 | metadata: |
||
26 | name: redis-operator |
||
27 | namespace: openshift-operators |
||
28 | spec: |
||
29 | channel: stable |
||
30 | installPlanApproval: Automatic |
||
31 | name: redis-operator |
||
32 | source: community-operators |
||
33 | sourceNamespace: openshift-marketplace |
||
34 | 5 | Peter Pfläging | ``` |
35 | 4 | Peter Pfläging | |
36 | 6 | Peter Pfläging | ## Usage |
37 | |||
38 | In your namespace use the following yaml to get a redundant redis cluster. |
||
39 | |||
40 | Pay special attentions to: |
||
41 | |||
42 | - storage size |
||
43 | - storage class (should be block storage for best performance) |
||
44 | 4 | Peter Pfläging | |
45 | 1 | Peter Pfläging | ```yaml |
46 | apiVersion: redis.redis.opstreelabs.in/v1beta1 |
||
47 | 3 | Peter Pfläging | kind: RedisCluster |
48 | 1 | Peter Pfläging | metadata: |
49 | 3 | Peter Pfläging | name: redis-cluster |
50 | 1 | Peter Pfläging | spec: |
51 | 3 | Peter Pfläging | clusterSize: 3 |
52 | 1 | Peter Pfläging | kubernetesConfig: |
53 | image: 'quay.io/opstree/redis:v6.2.5' |
||
54 | imagePullPolicy: IfNotPresent |
||
55 | resources: |
||
56 | limits: |
||
57 | cpu: 101m |
||
58 | memory: 128Mi |
||
59 | requests: |
||
60 | cpu: 101m |
||
61 | memory: 128Mi |
||
62 | serviceType: ClusterIP |
||
63 | redisExporter: |
||
64 | enabled: false |
||
65 | image: 'quay.io/opstree/redis-exporter:1.0' |
||
66 | 3 | Peter Pfläging | redisFollower: |
67 | serviceType: ClusterIP |
||
68 | redisLeader: |
||
69 | serviceType: ClusterIP |
||
70 | 1 | Peter Pfläging | storage: |
71 | volumeClaimTemplate: |
||
72 | spec: |
||
73 | 3 | Peter Pfläging | accessModes: |
74 | - ReadWriteOnce |
||
75 | 1 | Peter Pfläging | resources: |
76 | requests: |
||
77 | storage: 1Gi |
||
78 | storageClassName: rook-ceph-block |
||
79 | ``` |