apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: influxdb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: influxdb
  serviceName: influxdb
  template:
    metadata:
      labels:
        app: influxdb
    spec:
      serviceAccountName: influxdb
      containers:
      - name: influxdb
        image: influxdb:1.8.2
        env:
        - name: INFLUXDB_ADMIN_USER
          value: admin
        - name: INFLUXDB_ADMIN_PASSWORD
          value: admin
        - name: INFLUXDB_HTTP_AUTH_ENABLED
          value: "true" 
        - name: INFLUXDB_BIND_ADDRESS
          value: 0.0.0.0:8088
        ports:
        - containerPort: 8086
          name: api
          protocol: TCP
        volumeMounts:
        - mountPath: /var/lib/influxdb
          name: data
        livenessProbe:
          httpGet:
            path: /ping
            port: api
            scheme: HTTP
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes: ["ReadWriteOnce"]
      storageClassName: "fast" # StorageOS storageClass
      resources:
        requests:
          storage: 20Gi
