Keep the proxy tokens in Vault, External Secrets or a CSI driver
Keep the proxy and Grafana tokens out of Helm values and shell history. Your secrets tool hands them to the proxy as a Secret or as files, and a rotated token needs no restart.
The proxy needs two tokens: the proxy token from Tellagen and a Grafana token. Pick the tab for your tool, then tell the Add proxy page about it. For Helm, open Change the Secret name, or use Vault or token files. For Docker, open A secrets tool writes my token files. The commands on the page change to match.
Steps
Your own Secret
Put both tokens in one Secret
In the namespace tellagen, make a Secret with the key
tellagen-proxy-tokenfor the proxy token andgrafana-service-account-tokenfor the Grafana token. External Secrets, Sealed Secrets or SOPS can make it for you.Install with its name
On the Add proxy page, open Change the Secret name, or use Vault or token files. Keep A Kubernetes Secret, type the name in Name of the Secret, then run the install command. It holds
--set existingSecret=and the name.The page also prints a command that makes the Secret. Skip it when your tool makes the Secret.
Rotate a token
Change the value in the Secret, or let your tool do it. The proxy reads the token again within a minute, though Kubernetes can take a little longer to update a mounted Secret. To replace the proxy token by hand, run this where the new token file is.
Patch the Secret
kubectl -n tellagen patch secret tellagen-proxy \ -p "{\"stringData\":{\"tellagen-proxy-token\":\"$(cat tellagen-proxy-token)\"}}"
Vault Agent
Let Vault inject the files
On the Add proxy page, open Change the Secret name, or use Vault or token files and pick Files from Vault Agent or a CSI driver. In your values file, add the injector annotations to the pod and the two file paths. Turn on
serviceAccount.vaultAuth, so the pod has a token for Vault.Helm values for Vault Agent
podAnnotations: vault.hashicorp.com/agent-inject: "true" vault.hashicorp.com/role: tellagen-proxy vault.hashicorp.com/agent-inject-secret-tellagen-proxy-token: secret/data/tellagen/proxy vault.hashicorp.com/agent-inject-secret-grafana-token: secret/data/grafana/tellagen-proxy vault.hashicorp.com/agent-inject-template-tellagen-proxy-token: | {{- with secret "secret/data/tellagen/proxy" -}}{{ .Data.data.token }}{{- end -}} vault.hashicorp.com/agent-inject-template-grafana-token: | {{- with secret "secret/data/grafana/tellagen-proxy" -}}{{ .Data.data.token }}{{- end -}} secretFiles: tellagenToken: /vault/secrets/tellagen-proxy-token grafanaToken: /vault/secrets/grafana-token serviceAccount: vaultAuth: trueMake each file hold only the token
Vault Agent writes the whole secret unless you add a template. The two template annotations above print one key, here
token. Use the key that holds your token.Install with your values file
Add
-f values.yamlto the install command that the page prints. The command already holds--set-string grafana.url=and the two file paths. The chart makes no Secret for these tokens.
CSI driver
Mount the volume
Mount your driver volume with
extraVolumesandextraVolumeMounts, for example with the Vault CSI provider or the AWS or GCP provider. Your provider class must write two files namedtellagen-proxy-tokenandgrafana-token.Helm values for a CSI driver
extraVolumes: - name: proxy-secrets csi: driver: secrets-store.csi.k8s.io readOnly: true volumeAttributes: secretProviderClass: tellagen-proxy extraVolumeMounts: - name: proxy-secrets mountPath: /mnt/secrets readOnly: truePoint the chart at the files
On the Add proxy page, pick Files from Vault Agent or a CSI driver and type the folder, here /mnt/secrets, in Folder in the pod that holds the files. Left empty, it means /vault/secrets. The command then sets
secretFiles.tellagenTokenandsecretFiles.grafanaToken.
Docker host folder
Write the files to a folder
Set consul-template, Vault Agent or another tool to write
tellagen-proxy-tokenandgrafana-tokeninto one folder on the host. User 65532 must be able to read both files.Run the container on the folder
Open A secrets tool writes my token files, pick Files that a secrets tool writes and type the folder in Folder on this host that holds the files. The command mounts it read-only.
Docker run command
docker run -d --name tellagen-proxy --restart unless-stopped --read-only \ -v "/vault/secrets:/run/secrets/tellagen:ro" \ -e TELLAGEN_PROXY_TOKEN_FILE=/run/secrets/tellagen/tellagen-proxy-token \ -e GRAFANA_SERVICE_ACCOUNT_TOKEN_FILE=/run/secrets/tellagen/grafana-token \ -e TELLAGEN_INSTALL_METHOD=docker \ -e GRAFANA_URL='https://grafana.example.com' \ ghcr.io/tellagen/tellagen-proxy:<version>
What happens next
- The proxy reads each token file again every minute, and at once when Tellagen or Grafana refuses a token. A rotated token reaches it with no restart.
- The
configline of the doctor shows where the proxy read its token, never the token itself.
FAQs
The doctor says a token file “is missing or empty”. What do I check?
The path in the message isn't a file in the container. Check the mount, the file name, and that your tool or sidecar wrote the file.
The sidecar writes the files after the proxy starts. Is that a problem?
No. At start, the proxy waits up to 2 minutes for a token file that is missing or empty.
The doctor says a token file “cannot be read by user”. How do I fix it?
The container user can't read the file. The message names that user. Give the file the mode 0644, or make that user its owner. Docker Compose ignores the owner and mode you set for file secrets.
Helm says “tellagen.token and existingSecret are both set. Set only one.” Why?
A token is in your values and in the Secret or files. Remove
tellagen.tokenandgrafana.tokenfrom your values when you useexistingSecretorsecretFiles.The doctor says the value “is not a Tellagen proxy token”. Why?
The file holds more than the token, such as quotes or a line of a Vault template. Copy the whole token from Tellagen and nothing else.
Related guides
Did this help?
Updated . Something out of date? Write to [email protected]. Open Markdown version