Skip to content

Instantly share code, notes, and snippets.

@fdeantoni
Created November 24, 2021 07:55
Show Gist options
  • Select an option

  • Save fdeantoni/15022fa8bc99540ea32ad1c118384e41 to your computer and use it in GitHub Desktop.

Select an option

Save fdeantoni/15022fa8bc99540ea32ad1c118384e41 to your computer and use it in GitHub Desktop.
Redis Cluster stateful set for Kubernetes deployment.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis-cluster
namespace: redis
spec:
serviceName: redis-cluster
replicas: 6
selector:
matchLabels:
app: redis-cluster
template:
metadata:
labels:
app: redis-cluster
spec:
containers:
- name: redis
image: redis:alpine
ports:
- containerPort: 6379
name: client
- containerPort: 16379
name: gossip
command: ["/conf/update-node.sh", "redis-server", "/conf/redis.conf"]
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
volumeMounts:
- name: conf
mountPath: /conf
readOnly: false
- name: data
mountPath: /data
readOnly: false
volumes:
- name: conf
configMap:
name: redis-cluster
defaultMode: 0755
volumeClaimTemplates:
- metadata:
name: data
spec:
storageClassName: longhorn
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment