apiVersion: apps/v1
kind: StatefulSet
metadata:
  # This name uniquely identifies the StatefulSet
  name: minio
spec:
  serviceName: minio
  replicas: 1
  selector:
    matchLabels:
      app: minio # has to match .spec.template.metadata.labels
  template:
    metadata:
      labels:
        app: minio # has to match .spec.selector.matchLabels
    spec:
      containers:
        - name: minio
          env:
            - name: MINIO_ACCESS_KEY
              value: "minio"
            - name: MINIO_SECRET_KEY
              value: "minio123"
          image: minio/minio:RELEASE.2019-07-10T00-34-56Z
          args:
            - server
            - /data
          ports:
            - containerPort: 9000
          # These volume mounts are persistent. Each pod in the PetSet
          # gets a volume mounted based on this field.
          volumeMounts:
            - name: data
              mountPath: /data
          # Liveness probe detects situations where MinIO server instance
          # is not working properly and needs restart. Kubernetes automatically
          # restarts the pods if liveness checks fail.
          livenessProbe:
            httpGet:
              path: /minio/health/live
              port: 9000
            initialDelaySeconds: 120
            periodSeconds: 20
  # These are converted to volume claims by the controller
  # and mounted at the paths mentioned above.
  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi