kind: Service
apiVersion: v1
metadata:
  labels:
    app: redis-slave2
  name: redis-slave2
  namespace: edoc2
spec:
  #clusterIP: None
  ports:
  - name: redis2
    port: 36380
    targetPort: 36380
    #nodePort: 36380
  selector:
    app: redis-slave2
  type: ClusterIP
  #type: NodePort
---
#kind: StatefulSet
kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: redis-slave2
  name: redis-slave2
  namespace: edoc2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis-slave2
  #serviceName: redis-slave2
  template:
    metadata:
      labels:
        app: redis-slave2
    spec:
      hostname: redis-slave2
      initContainers:
      - name: increase-somaxconn-map
        image: registry.edoc2.com:5000/library/busybox:1.28
        command: ["sysctl", "-w", "net.core.somaxconn=8096"]
        securityContext:
          privileged: true
      containers:
      - args:
        - -c
        - cp /mnt/redis-slave2.conf /data/ ; redis-server /data/redis-slave2.conf
        command:
        - sh
        image: registry.edoc2.com:5000/edoc2v5/redis:prod600-v4.0.14.8
        imagePullPolicy: IfNotPresent
        name: redis-slave2
        ports:
        - containerPort: 36380
          name: slaveport
          protocol: TCP
        volumeMounts:
        - mountPath: /mnt/
          name: config-volume
          readOnly: false
        - mountPath: /data/
          name: redis-storage-data
          readOnly: false
      serviceAccountName: redis-sentinel
      terminationGracePeriodSeconds: 15
      restartPolicy: Always
      volumes:
      - configMap:
          items:
          - key: redis-slave2.conf
            path: redis-slave2.conf
          name: redis-sentinel-config
        name: config-volume
      - name: redis-storage-data
        hostPath:
          path: /data/redis/
      #- name: redis-storage-data
      #  persistentVolumeClaim:
      #    claimName: local-redis-storage
      nodeSelector:
        # "node.labels.nodelabels": Middleware
        "node.redis3.labels": redis-node03
  #volumeClaimTemplates:
  #- metadata:
  #    name: redis-storage-data
  #  spec:
  #    accessModes: [ "ReadWriteOnce" ]
  #    storageClassName: "local-redis-storage"
  #    resources:
  #      requests:
  #        storage: 50Gi
