Files
mg4/k8s/secrets/secrets.example.yaml
T
nilsandClaude Opus 5.5 9226616261 Grafana's read-only InfluxDB token is made automatically
The read-only token for Grafana needed a manual influx command and a
Secret. InfluxDB generates every token but the admin one and ignores a
chosen value (tested on 2.7.12), so it cannot be preset in a Secret.

Instead an init container in the Grafana pod creates it at every start
with the admin token, deletes the one from the previous start, and
writes only the read-only token to a memory-backed volume; the
provisioned datasource reads it with $__file{/run/influx/token}. The
Grafana process never sees the admin token. The grafana-influx Secret
is gone from the template and the README.

Tested in podman: InfluxDB 2.7.12, the script run twice as the Grafana
user (the old token is replaced, not piled up), and Grafana 13.2.3
reporting the datasource healthy with the file-based token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
2026-10-18 19:05:58 +02:00

44 lines
1.5 KiB
YAML

# TEMPLATE ONLY — not part of kustomization.yaml. Copy it to k8s/secrets/secrets.yaml
# (gitignored), fill in real values there, and apply that file yourself. Never put real values
# in here. This folder is outside `kubectl apply -f k8s/`, which does not recurse.
#
# openssl rand -hex 32 for every token and password below
apiVersion: v1
kind: Secret
metadata:
name: influxdb-auth
namespace: mg4
type: Opaque
stringData:
admin-password: CHANGE-ME-at-least-8-characters
admin-token: CHANGE-ME-openssl-rand-hex-32
---
apiVersion: v1
kind: Secret
metadata:
name: mg4-server
namespace: mg4
type: Opaque
stringData:
# The car's write token, entered in the app. At least 24 characters, or the server
# refuses to start.
INGEST_TOKEN: CHANGE-ME-openssl-rand-hex-32
# Approves a car on your phone when it pairs by QR code (at least 12 characters). Leave it
# empty to switch pairing off; then only the INGEST_TOKEN above works.
APPROVAL_PASSWORD: CHANGE-ME-at-least-12-characters
# A forge token that can only READ the nils/mg4 repository, for app updates (the server
# relays the releases to the car; k8s/README.md, "App updates"). Leave it empty to switch
# updates off.
FORGE_TOKEN: CHANGE-ME-read-only-forge-token
---
apiVersion: v1
kind: Secret
metadata:
name: grafana-admin
namespace: mg4
type: Opaque
stringData:
# Grafana's admin login (user "admin"). Only read on first start: change it in Grafana
# afterwards, or reset it with grafana cli.
admin-password: CHANGE-ME