Looking through the values for S3 I realised that secrets have to be stored in clear text:
loki:
storage:
type: s3
s3:
endpoint: "minio.local:9000"
s3ForcePathStyle: true
accessKeyId: "secretId"
secretAccessKey: "secretKey"
I’m using gitops (Flux CD) to manage my cluster, so I don’t want to push secrets in plain text to git, and the values are then stored in a configmap in clear text after being installed.
I found this option, that would allow me do save the whole of config.yaml
as a secret and mount it:
loki:
existingSecretForConfig: "secretConfig"
Is there not a way to use kubernetes secrets for the few fields in the configuration?
Maybe new fields, with the name of a file containing the secret?
loki:
storage:
type: s3
s3:
endpoint: "minio.local:9000"
s3ForcePathStyle: true
accessKeyIdFile: "/secrets/s3/accessKeyId"
secretAccessKeyFile: "/secrets/s3/secretAccessKey"
Can I use environment variables in loki’s configuration?
Something like this?
loki:
storage:
type: s3
s3:
endpoint: "minio.local:9000"
s3ForcePathStyle: true
accessKeyId: "${S3_KEY_ID}"
secretAccessKey: "${S3_ACCESS_KEY}"
So that the configmap looks like this?
apiVersion: v1
kind: ConfigMap
data:
config.yaml: |
auth_enabled: false
common:
compactor_address: 'loki-read'
path_prefix: /var/loki
replication_factor: 3
storage:
s3:
access_key_id: "${S3_KEY_ID}"
bucketnames: loki-chunks
endpoint: minio.local:9000
s3forcepathstyle: true
secret_access_key: "${S3_ACCESS_KEY}"