-
Notifications
You must be signed in to change notification settings - Fork 16
Configuration
Shai Moria edited this page Dec 30, 2020
·
7 revisions
The Redis nodes are scheduled on K8s nodes according to pod affinity rules equivalent to the YAML configurations below.
For the leaders:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- "redis"
topologyKey: "kubernetes.io/hostname"
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "redis-node-role"
operator: In
values:
- "leader"
topologyKey: "failure-domain.beta.kubernetes.io/zone"
For the followers (replicas):
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- "redis"
topologyKey: "kubernetes.io/hostname"
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "redis-node-role"
operator: In
values:
- "leader"
- key: "redis-cluster-id"
operator: In
values:
- <leader-number>
topologyKey: "failure-domain.beta.kubernetes.io/zone"
apiVersion: db.payu.com/v1
kind: RedisCluster
metadata:
name: rdc-test
namespace: infra
spec:
leaderCount: 3
leaderFollowersCount: 2
image: "redis:testing"
initContainer:
image: "redis-init:testing"
prometheusExporter:
port: 9121
image: metrics-exporter:testing
imagePullSecrets: "regcred"
redisContainerResources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 50m
memory: 50Mi
podLabelSelector:
app: "redis"
podAnnotations:
sidecar.istio.io/inject: "false"
affinity:
hostTopologyKey: "kubernetes.io/hostname"
zoneTopologyKey: "failure-domain.beta.kubernetes.io/zone"
redisContainerEnvVariables:
- name: PORT
value: '6379'
- name: CONF_PATH
value: '/usr/local/etc/redis/redis.conf'
Field Name | Mandatory | Type | Description |
---|---|---|---|
prometheusExporter | False | Dictionary: image,port,imagePullPolicy | Prometheus exporter side car. Recommended: https://github.com/oliver006/redis_exporter |
initContainer | False | Dictionary image,enabledHugepage,imagePullPolicy |