forked from k-space/kube
45 lines
801 B
YAML
45 lines
801 B
YAML
|
apiVersion: apps/v1
|
||
|
kind: StatefulSet
|
||
|
metadata:
|
||
|
name: redis
|
||
|
spec:
|
||
|
serviceName: redis
|
||
|
replicas: 1
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app: redis
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: redis
|
||
|
spec:
|
||
|
containers:
|
||
|
- name: redis
|
||
|
image: redis:alpine
|
||
|
ports:
|
||
|
- containerPort: 6379
|
||
|
name: client
|
||
|
securityContext:
|
||
|
readOnlyRootFilesystem: true
|
||
|
runAsNonRoot: true
|
||
|
runAsUser: 999
|
||
|
command: ["redis-server", "--save"]
|
||
|
env:
|
||
|
- name: POD_IP
|
||
|
valueFrom:
|
||
|
fieldRef:
|
||
|
fieldPath: status.podIP
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
name: redis
|
||
|
spec:
|
||
|
type: ClusterIP
|
||
|
ports:
|
||
|
- port: 6379
|
||
|
targetPort: 6379
|
||
|
name: client
|
||
|
selector:
|
||
|
app: redis
|