1 Star 0 Fork 5

zhuchance/redis-cluster-on-k8s

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
redis-cluster.yaml 3.53 KB
一键复制 编辑 原始数据 按行查看 历史
root 提交于 2020-12-04 16:22 . init commit
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: redis-cluster-data-ips-claim
namespace: test
spec:
accessModes:
- ReadWriteMany
storageClassName: ceph-fs-gd-1
resources:
requests:
storage: 100Mi
---
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-conf
namespace: test
data:
redis.conf: |
port 6379
dir /data
daemonize yes
cluster-enabled yes
cluster-node-timeout 15000
cluster-config-file nodes.conf
appendonly yes
appendfilename "appendonly.aof"
protected-mode no
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: redis-cluster-pdb
namespace: test
spec:
selector:
matchLabels:
app: redis-cluster
maxUnavailable: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis-cluster
namespace: test
spec:
serviceName: redis-cluster-hs
replicas: 6
selector:
matchLabels:
app: redis-cluster
updateStrategy:
type: RollingUpdate
podManagementPolicy: Parallel
template:
metadata:
labels:
app: redis-cluster
spec:
#affinity:
#podAntiAffinity:
#requiredDuringSchedulingIgnoredDuringExecution:
#- labelSelector:
# matchExpressions:
# - key: "app"
# operator: In
# values:
#- redis-cluster
#topologyKey: "kubernetes.io/hostname"
containers:
- name: redis-cluster
image: 172.168.27.239/devops/redis:5.0.8-cluster
imagePullPolicy: Always
command: ["/usr/local/bin/start.sh"]
# command: ["redis-server"]
# args: ["/etc/redis/redis.conf","--cluster-announce-ip","$(MY_POD_IP)"]
resources:
limits:
cpu: 0.5
memory: 512Mi
requests:
cpu: 0.1
memory: 100Mi
ports:
- containerPort: 6379
name: port1
protocol: TCP
volumeMounts:
- name: data
mountPath: "/data"
- name: redis-conf
mountPath: "/etc/redis/"
- name: data-ips
mountPath: "/data-ips"
env:
- name: TZ
value: "Asia/Shanghai"
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
volumes:
- name: data-ips
persistentVolumeClaim:
claimName: redis-cluster-data-ips-claim
- name: redis-conf
configMap:
name: redis-conf
items:
- key: redis.conf
path: redis.conf
initContainers:
- name: init-redis
image: 172.168.27.239/devops/busybox:1.28.3
command:
- sh
- -c
- |
ulimit -n 65536
echo 511 > /proc/sys/net/core/somaxconn
echo 'vm.overcommit_memory=1' > /etc/sysctl.conf
mount -o remount rw /sys
echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag
securityContext:
privileged: true
volumeClaimTemplates:
- metadata:
name: data
labels:
app: redis-cluster
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: ceph-rbd-gd-1
resources:
requests:
storage: 1Gi
---
kind: Service
apiVersion: v1
metadata:
name: redis-cluster-hs
namespace: test
labels:
app: redis-cluster
spec:
selector:
app: redis-cluster
clusterIP: None
ports:
- port: 6379
targetPort: 6379
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/meoom/redis-cluster-on-k8s.git
git@gitee.com:meoom/redis-cluster-on-k8s.git
meoom
redis-cluster-on-k8s
redis-cluster-on-k8s
master

搜索帮助