100 lines
2.3 KiB
YAML
100 lines
2.3 KiB
YAML
apiVersion: apps/v1beta1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: rd
|
|
spec:
|
|
serviceName: "redis"
|
|
replicas: 3
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: redis
|
|
spec:
|
|
initContainers:
|
|
- name: install
|
|
image: harbor-001.jimmysong.io/library/redis-install-3.2.0:e2e
|
|
imagePullPolicy: Always
|
|
args:
|
|
- "--install-into=/opt"
|
|
- "--work-dir=/work-dir"
|
|
volumeMounts:
|
|
- name: opt
|
|
mountPath: "/opt"
|
|
- name: workdir
|
|
mountPath: "/work-dir"
|
|
- name: bootstrap
|
|
image: harbor-001.jimmysong.io/library/debian:jessie
|
|
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
|
|
image: harbor-001.jimmysong.io/library/debian:jessie
|
|
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
|
|
|