tl;dr:

ruler:
  storage:
    s3:
      bucketnames: <bucket-name>
      s3: s3://<bucket-name>
      endpoint: https://s3.<region>.backblazeb2.com
      access_key_id: <key id>
      secret_access_key: <key>
      s3forcepathstyle: false
	  insecure: false
    type: s3

If you want to use buckets with the Loki helm chart, this configuration is most likely the cleanest way to do it. The -config.expand-env=true flag allows Loki to read config variables from env & the chart allows you to fill placeholders into the config. A secret example can also be found below.

# values.yaml
deploymentMode: SimpleScalable
loki:
  storage:
    bucketNames:
      chunks: ${bucket}
      ruler: ${bucket}
      admin: ${bucket}
    type: s3
    s3:
      endpoint: ${endpoint}
      secretAccessKey: ${secretAccessKey}
      accessKeyId: ${accessKeyId}
  schemaConfig:
    configs:
      - from: 2024-04-01
        object_store: s3
        store: tsdb
        schema: v13
        index:
          prefix: index_
          period: 24h
# https://github.com/grafana/loki/issues/12218
# https://github.com/grafana/loki/issues/8572
backend:
  extraArgs:
    - -config.expand-env=true
  extraEnvFrom: 
    - secretRef:
        name: loki-objstore-secret
read:
  extraArgs:
    - -config.expand-env=true
  extraEnvFrom: 
    - secretRef:
        name: loki-objstore-secret
write:
  extraArgs:
    - -config.expand-env=true
  extraEnvFrom: 
    - secretRef:
        name: loki-objstore-secret
# secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: loki-objstore-secret
type: Opaque
data:
  bucket: xxx
  endpoint: xxx
  accessKeyId: xxx
  secretAccessKey: xxx

📃 Happy Logging! :)

Hits