# 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.

## Before you start

### Intended audience

Platform and security engineers who store secrets in a secrets tool.

### Required permissions

An admin must have added the proxy in Tellagen. You need permission to change the namespace or the host where the proxy runs.


## Procedure

### Your own Secret

<a id="step-secret-put-the-tokens-in"></a>

1. **Put both tokens in one Secret.** In the namespace tellagen, make a Secret with the key `tellagen-proxy-token` for the proxy token and `grafana-service-account-token` for the Grafana token. External Secrets, Sealed Secrets or SOPS can make it for you.

<a id="step-secret-install-with-its-name"></a>

2. **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.

<a id="step-secret-rotate-a-token"></a>

3. **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:

```shell
kubectl -n tellagen patch secret tellagen-proxy \
  -p "{\"stringData\":{\"tellagen-proxy-token\":\"$(cat tellagen-proxy-token)\"}}"
```

### Vault Agent

<a id="step-vault-inject-the-files"></a>

1. **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:

```yaml
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: true
```

<a id="step-vault-hold-only-the-token"></a>

2. **Make 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.

<a id="step-vault-install"></a>

3. **Install with your values file.** Add `-f values.yaml` to 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

<a id="step-csi-mount-the-volume"></a>

1. **Mount the volume.** Mount your driver volume with `extraVolumes` and `extraVolumeMounts`, for example with the Vault CSI provider or the AWS or GCP provider. Your provider class must write two files named `tellagen-proxy-token` and `grafana-token`.

Helm values for a CSI driver:

```yaml
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: true
```

<a id="step-csi-point-the-chart"></a>

2. **Point 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.tellagenToken` and `secretFiles.grafanaToken`.

### Docker host folder

<a id="step-folder-write-the-files"></a>

1. **Write the files to a folder.** Set consul-template, Vault Agent or another tool to write `tellagen-proxy-token` and `grafana-token` into one folder on the host. User 65532 must be able to read both files.

<a id="step-folder-run-the-container"></a>

2. **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:

```shell
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 `config` line of the doctor shows where the proxy read its token, never the token itself.

## FAQs

<a id="troubleshooting-the-doctor-says-a-token-file-is-missing-or-empty-what-do-i-check"></a>

### 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.

<a id="troubleshooting-the-sidecar-writes-the-files-after-the-proxy-starts-is-that-a-problem"></a>

### 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.

<a id="troubleshooting-the-doctor-says-a-token-file-cannot-be-read-by-user-how-do-i-fix-it"></a>

### 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.

<a id="troubleshooting-helm-says-tellagen-token-and-existingsecret-are-both-set-set-only-one-why"></a>

### 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.token` and `grafana.token` from your values when you use `existingSecret` or `secretFiles`.

<a id="troubleshooting-the-doctor-says-the-value-is-not-a-tellagen-proxy-token-why"></a>

### 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 articles

- **Recommended next task:** [Install the proxy with Docker, Compose or Helm](https://tellagen.com/help/install-the-proxy)
- [Read the proxy doctor output](https://tellagen.com/help/read-the-proxy-doctor-output)


## Continue through the incident lifecycle

- **Previous task:** [Create the Grafana token for the proxy](https://tellagen.com/help/create-the-grafana-token-for-the-proxy)
- **Next task:** [Connect the proxy through a corporate network](https://tellagen.com/help/connect-the-proxy-through-a-corporate-network)
- [Back to Support Center](https://tellagen.com/help#help-search)

## Updated

2026-11-25
