apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: loki
  namespace: bytelyst-infra
  labels:
    app: loki
spec:
  replicas: 1
  serviceName: loki
  selector:
    matchLabels:
      app: loki
  template:
    metadata:
      labels:
        app: loki
    spec:
      containers:
      - name: loki
        image: grafana/loki:2.9.0
        args: ["-config.file=/etc/loki/local-config.yaml"]
        ports:
        - containerPort: 3100
          name: http
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /ready
            port: 3100
          initialDelaySeconds: 15
          periodSeconds: 10
        volumeMounts:
        - name: loki-data
          mountPath: /loki
  volumeClaimTemplates:
  - metadata:
      name: loki-data
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 5Gi
---
apiVersion: v1
kind: Service
metadata:
  name: loki
  namespace: bytelyst-infra
spec:
  selector:
    app: loki
  ports:
  - name: http
    port: 3100
    targetPort: 3100
---
apiVersion: v1
kind: Service
metadata:
  name: loki-external
  namespace: bytelyst-infra
spec:
  type: NodePort
  selector:
    app: loki
  ports:
  - name: http
    port: 3100
    targetPort: 3100
    nodePort: 3100
