add redis statefulset with openebs pvc
parent
9b6dc8cf64
commit
3d97261dc2
|
@ -0,0 +1,99 @@
|
|||
apiVersion: apps/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: rd
|
||||
spec:
|
||||
serviceName: "redis"
|
||||
replicas: 3
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: redis
|
||||
spec:
|
||||
initContainers:
|
||||
- name: install
|
||||
image: sz-pg-oam-docker-hub-001.tendcloud.com/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: sz-pg-oam-docker-hub-001.tendcloud.com/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: sz-pg-oam-docker-hub-001.tendcloud.com/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
|
||||
|
Loading…
Reference in New Issue