apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-statefulset
  labels:
    app: redis
spec:
  serviceName: "redis"
  replicas: 1
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
    spec:
      containers:
      - name: redis
        image: redis:5.0.7
        ports:
        - containerPort: 6379
          name: redisdb
        volumeMounts:
        - name: redis-data
          mountPath: /var/lib/redis/data
      volumes:
      - name: redis-data
        persistentVolumeClaim:
          claimName: redis-pvc