...
1apiVersion: apps/v1
2kind: ReplicaSet
3metadata:
4 name: redis-slave
5 labels:
6 app: redis
7 role: slave
8 tier: backend
9spec:
10 # this replicas value is default
11 # modify it according to your case
12 replicas: 2
13 selector:
14 matchLabels:
15 app: redis
16 role: slave
17 tier: backend
18 template:
19 metadata:
20 labels:
21 app: redis
22 role: slave
23 tier: backend
24 spec:
25 containers:
26 - name: slave
27 image: docker.io/library/redis:5.0.5-alpine
28 # We are only implementing the dns option of:
29 # https://github.com/kubernetes/examples/blob/97c7ed0eb6555a4b667d2877f965d392e00abc45/guestbook/redis-slave/run.sh
30 command: [ "redis-server", "--slaveof", "redis-master", "6379" ]
31 resources:
32 requests:
33 cpu: 100m
34 memory: 100Mi
35 env:
36 - name: GET_HOSTS_FROM
37 value: dns
38 # If your cluster config does not include a dns service, then to
39 # instead access an environment variable to find the master
40 # service's host, comment out the 'value: dns' line above, and
41 # uncomment the line below.
42 # value: env
43 ports:
44 - containerPort: 6379
View as plain text