---
apiVersion: v1
kind: Service
metadata:
  name: redis
  labels:
    app: redis
spec:
  clusterIP: None
  selector:
    app: redis
  ports:
    - port: 6379
      name: redis
      protocol: TCP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis
spec:
  selector:
    matchLabels:
      app: redis
  serviceName: redis
  template:
    metadata:
      labels:
        app: redis
    spec:
      restartPolicy: Always
      terminationGracePeriodSeconds: 0
      containers:
        - name: redis
          image: redis
          readinessProbe:
            tcpSocket:
              port: 6379
            periodSeconds: 1
            failureThreshold: 300
          ports:
            - containerPort: 6379
              name: redis
              protocol: TCP
