kubernetes-handbook/manifests/openebs/redis-statefulset.yml

100 lines
2.3 KiB
YAML
Raw Normal View History

2018-01-05 21:00:19 +08:00
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: rd
spec:
serviceName: "redis"
replicas: 3
template:
metadata:
labels:
app: redis
spec:
initContainers:
- name: install
2018-05-04 19:53:39 +08:00
image: harbor-001.jimmysong.io/library/redis-install-3.2.0:e2e
2018-01-05 21:00:19 +08:00
imagePullPolicy: Always
args:
- "--install-into=/opt"
- "--work-dir=/work-dir"
volumeMounts:
- name: opt
mountPath: "/opt"
- name: workdir
mountPath: "/work-dir"
- name: bootstrap
2018-05-04 19:53:39 +08:00
image: harbor-001.jimmysong.io/library/debian:jessie
2018-01-05 21:00:19 +08:00
command:
- "/work-dir/peer-finder"
args:
- -on-start="/work-dir/on-start.sh"
- "-service=redis"
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
volumeMounts:
- name: opt
mountPath: "/opt"
- name: workdir
mountPath: "/work-dir"
containers:
- name: redis
2018-05-04 19:53:39 +08:00
image: harbor-001.jimmysong.io/library/debian:jessie
2018-01-05 21:00:19 +08:00
ports:
- containerPort: 6379
name: peer
command:
- /opt/redis/redis-server
args:
- /opt/redis/redis.conf
readinessProbe:
exec:
command:
- sh
- -c
- "/opt/redis/redis-cli -h $(hostname) ping"
initialDelaySeconds: 15
timeoutSeconds: 5
volumeMounts:
- name: datadir
mountPath: /data
- name: opt
mountPath: /opt
volumes:
- name: opt
emptyDir: {}
- name: workdir
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: datadir
annotations:
volume.beta.kubernetes.io/storage-class: openebs-redis
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1G
---
# A headless service to create DNS records
apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
name: redis
labels:
app: redis
spec:
ports:
- port: 6379
name: peer
# *.redis.default.svc.cluster.local
clusterIP: None
selector:
app: redis