A new Overview style: the Grid over the roads round the car from
OpenStreetMap, drawn in the floor's perspective, heading up, the bigger
roads glowing brighter, the car as a chevron.
Server: POST /v1/map/roads {z:14,x,y} fetches a tile's drivable roads
from Overpass (OVERPASS_URL; one request at a time, at least a second
apart), simplifies them to tile-local points in four classes, caches
them for 30 days and never logs the tile.
App: MapRoads keeps the 3x3 tiles round the car from its own cache or
the server; GPS only while the style is shown; bearing from the GPS or
from successive positions. Without GPS, server or roads the plain floor
says why. OSM attribution on screen and in LICENSE.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
Kubernetes manifests — car.k8s.stinnesbeck.com
Plain manifests for the car server, InfluxDB 2 and Grafana. They are only files: nothing here is applied automatically. Apply them yourself.
| File | What |
|---|---|
namespace.yaml |
Namespace mg4 |
influxdb.yaml |
InfluxDB 2.7.12 StatefulSet (10Gi PVC, default storage class), cluster-internal Service, NetworkPolicy admitting only the server and Grafana |
server.yaml |
Go server Deployment (1 replica, non-root, read-only root filesystem) and Service |
grafana.yaml |
Grafana 13.2.3 Deployment (1Gi PVC), Service; datasource and dashboards provisioned |
grafana/ |
The provisioned InfluxDB datasource and the MG4 dashboards (Live, Consumption, Charging) |
ingress.yaml |
Traefik IngressRoutes for car.k8s.stinnesbeck.com and Grafana, TLS from Traefik's default certificate |
secrets/secrets.example.yaml |
Template for the Secrets; placeholders only, not in kustomization.yaml |
secrets/secrets.yaml |
Your filled-in copy — gitignored, never committed |
kustomization.yaml |
Everything except the Secrets; generates the Grafana ConfigMaps |
Before the first apply
- Check
ingress.yaml: Grafana's host (placeholdercar-grafana.k8s.stinnesbeck.com). Both routes use thetraefik-internalclass, and both hosts must be covered by Traefik's default certificate. - Create the Secrets.
cp k8s/secrets/secrets.example.yaml k8s/secrets/secrets.yaml(gitignored), replace everyCHANGE-MEthere (openssl rand -hex 32):influxdb-auth,mg4-server(ingest token, approval password for pairing, the forge token for app updates) andgrafana-admin. Keep the template itself on placeholders only. - Registry access. The
mg4-serverpackage on git.stinnesbeck.com is public, so no pull secret is needed. If you make it private, add animagePullSecretsentry toserver.yaml.
Apply
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/secrets/secrets.yaml
kubectl apply -k k8s/
Use -k, not -f k8s/: plain -f applies the files without kustomize, so the Grafana
ConfigMaps (datasource and dashboards) are never created and Grafana does not start.
Grafana's InfluxDB token
Grafana reads InfluxDB with a token that can only read the mg4 bucket. Nothing to do: an init
container in the Grafana pod creates it at every start with the admin token, deletes the one
from the previous start, and hands Grafana only the read-only token (in a memory-backed volume).
The Grafana process itself never sees the admin token. InfluxDB generates every token but the
admin one itself, which is why this cannot be a value in the Secret.
App updates
The server relays the app's releases from the private repository to the car's updater
(OTA.md). It reads them with FORGE_TOKEN from the mg4-server Secret: create a token in
the forge that can only read the nils/mg4 repository, put it there, apply the Secret and
restart the server. Without it, updates are off (the car's updater gets a 404). FORGE_URL
and FORGE_REPO are set in server.yaml.
Agent access
agent-access/ creates a service account limited to the mg4
namespace (read-only by default, no Secrets, no exec) and a script that writes a kubeconfig with a
time-limited token for it. Applied separately, with kubectl apply -k k8s/agent-access/.
Notes
- InfluxDB's setup mode runs only on an empty volume. Changing
admin-tokenin the Secret later does not change the token inside InfluxDB. - The server uses the InfluxDB admin token; a token scoped to read/write on the
mg4bucket can replace it later. Grafana has its own read-only token (above). - The dashboards are read-only in Grafana's UI. Change the JSON in
grafana/dashboards/; the ConfigMap name changes with its content, which rolls Grafana. - The server image is pinned by digest in
server.yaml. To upgrade, push a new tag and put its digest there (skopeo inspect docker://git.stinnesbeck.com/nils/mg4-server:<tag>).