Skip to content

Instantly share code, notes, and snippets.

@monsterxx03
Created July 10, 2020 10:22
Show Gist options
  • Save monsterxx03/55e3e62c9de643c2be5a87effa7d4153 to your computer and use it in GitHub Desktop.
Save monsterxx03/55e3e62c9de643c2be5a87effa7d4153 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
data:
redis.conf: |-
bind 0.0.0.0
port 6379
protected-mode no
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
save ""
maxmemory 5GB
maxmemory-policy allkeys-lru
appendonly no
cluster-enabled yes
cluster-require-full-coverage no
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis-cluster
labels:
app: redis-cluster
spec:
serviceName: redis-cluster
replicas: 3
selector:
matchLabels:
app: redis-cluster
updateStrategy:
type: OnDelete
template:
metadata:
labels:
app: redis-cluster
annotations:
spec:
securityContext:
sysctls:
- name: net.core.somaxconn
value: "1024"
volumes:
- name: host-sys
hostPath:
path: /sys
- name: config
configMap:
name: redis-config
initContainers:
- name: sysctl-config
image: busybox
volumeMounts:
- name: host-sys
mountPath: /host-sys
command: ["sh", "-c", "echo never >/host-sys/kernel/mm/transparent_hugepage/enabled"]
terminationMessagePolicy: FallbackToLogsOnError
containers:
- name: redis
image: redis:6.0.4-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 6379
name: client
- containerPort: 16379
name: gossip
command: ["sh", "-c", "redis-server /config/redis.conf"]
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: config
mountPath: /config
readinessProbe:
exec:
command:
- sh
- -c
- "redis-cli ping"
timeoutSeconds: 5
livenessProbe:
exec:
command:
- sh
- -c
- "redis-cli ping"
periodSeconds: 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment