apiVersion: apps/v1 kind: StatefulSet metadata: name: loki namespace: observability labels: app: loki spec: serviceName: loki replicas: 1 selector: matchLabels: app: loki template: metadata: labels: app: loki annotations: prometheus.io/scrape: "true" prometheus.io/port: "3100" spec: nodeSelector: kubernetes.io/hostname: hetzner-2 securityContext: fsGroup: 10001 runAsGroup: 10001 runAsNonRoot: true runAsUser: 10001 containers: - name: loki image: grafana/loki:3.2.1 args: - '-config.file=/etc/loki/loki.yaml' - '-target=all' ports: - name: http containerPort: 3100 protocol: TCP - name: grpc containerPort: 9096 protocol: TCP livenessProbe: httpGet: path: /ready port: http initialDelaySeconds: 45 periodSeconds: 10 timeoutSeconds: 5 readinessProbe: httpGet: path: /ready port: http initialDelaySeconds: 45 periodSeconds: 10 timeoutSeconds: 5 resources: requests: cpu: 500m memory: 1Gi limits: cpu: 2000m memory: 2Gi volumeMounts: - name: loki-config mountPath: /etc/loki - name: loki-data mountPath: /loki volumes: - name: loki-config configMap: name: loki-config - name: loki-data persistentVolumeClaim: claimName: loki-data --- apiVersion: v1 kind: Service metadata: name: loki namespace: observability labels: app: loki spec: type: ClusterIP ports: - port: 3100 targetPort: http protocol: TCP name: http - port: 9096 targetPort: grpc protocol: TCP name: grpc selector: app: loki