Manage secrets
Ark resources such as models, MCP servers, tools and queries read credentials from Kubernetes Secrets through secretKeyRef. Ark marks the Secrets it manages with two labels:
metadata:
labels:
ark.mckinsey.com/resource-type: secret
ark.mckinsey.com/scope: sharedThe labels tell Ark secrets apart from the other Secrets in the namespace, such as service account tokens, Helm release records or the credentials of other applications.
The dashboard Secrets page and the /v1/secrets API serve only Secrets that carry both labels, and the caller’s own personal Secrets. GET, PUT and DELETE on any other Secret return 404. To manage an existing Secret from the dashboard, label it as described in Upgrading.
Resources can reference a Secret with or without the labels, and the reference resolves the same way. Personal Secrets are the exception: they resolve only from a header of a Query mcpserver override, and Ark API accepts that reference only from the Secret’s owner, in an override that selects one server by name. The API also checks any Secret named with the reserved u-<owner>- prefix.
Secret pickers in dashboard forms list the shared Ark secrets in the namespace. Pick one, or type the name of a Secret created outside Ark. The form reads the Secret’s token key, so a Secret you type must have one.
Create a secret in the dashboard, the API, the Ark CLI or the SDK
These write the labels for you:
- In the dashboard, open Secrets and select Add secret, or use Add New next to any secret picker.
POST /v1/secretsadds both labels to the Secret it creates, next to the tags passed in the request’slabelsfield.ark models createstores the model’s API key in a Secret named<model>-model-secretand labels it. If that Secret already exists, it keeps its other labels, annotations and keys. It refuses a model name that starts with a reserved prefix and never updates a personal secret.- The Python SDK’s
SecretClient.create_secret, also available asArkClient.secrets, labels the Secret it creates and raisesValueErrorfor a reserved name.
Updating a Secret through PUT /v1/secrets/{name} keeps its labels, unless the request makes a personal Secret shared. A Secret without them gets a 404, so label it with kubectl first.
Create a secret with kubectl
kubectl create secret cannot set labels, so create the Secret and then label it:
kubectl create secret generic default-model-token \
--from-literal=token='YOUR_API_KEY'
kubectl label secret default-model-token \
ark.mckinsey.com/resource-type=secret ark.mckinsey.com/scope=sharedTo create or rotate the value in one step, render the Secret, add the labels and apply it server-side:
kubectl create secret generic default-model-token \
--from-literal=token='YOUR_API_KEY' --dry-run=client -o yaml \
| kubectl label --local -f - \
ark.mckinsey.com/resource-type=secret ark.mckinsey.com/scope=shared -o yaml \
| kubectl apply --server-side --force-conflicts -f -Keep --server-side. Client-side kubectl apply, the default, writes a second copy of every value into the Secret’s kubectl.kubernetes.io/last-applied-configuration annotation.
Create a secret with GitOps
When Argo CD, Flux or another GitOps tool manages your resources, put the labels in the manifest. The Secret and the resource that references it then go into the cluster together:
apiVersion: v1
kind: Secret
metadata:
name: default-model-token
namespace: team-a
labels:
ark.mckinsey.com/resource-type: secret
ark.mckinsey.com/scope: shared
type: Opaque
stringData:
token: YOUR_API_KEY
---
apiVersion: ark.mckinsey.com/v1alpha1
kind: Model
metadata:
name: default
namespace: team-a
spec:
provider: openai
model:
value: gpt-4o-mini
config:
openai:
baseUrl:
value: https://api.openai.com/v1
apiKey:
valueFrom:
secretKeyRef:
name: default-model-token
key: tokenDon’t commit the value itself. Keep it in an external store and let an operator write the Secret, as the data flow and encryption guide suggests. With External Secrets Operator the labels go in the target template:
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: default-model-token
namespace: team-a
spec:
refreshInterval: 1h
secretStoreRef:
name: vault
kind: SecretStore
target:
name: default-model-token
template:
metadata:
labels:
ark.mckinsey.com/resource-type: secret
ark.mckinsey.com/scope: shared
data:
- secretKey: token
remoteRef:
key: ark/team-a/openai
property: api-keySealed Secrets takes the same labels under spec.template.metadata.labels. With SOPS, the encrypted file is a plain Secret manifest, so the labels sit in metadata.labels as in the first example.
Personal secrets
A personal Secret belongs to one signed-in user. Only that user can list, read, change and delete it through the dashboard and /v1/secrets, and it can only be sent as a header to an MCP server from a Query. Use it for credentials tied to one person, such as a GitHub personal access token.
Who counts as a user
Personal Secrets need a user identity from a JWT. Ark API has one when it runs with AUTH_MODE=sso, or with AUTH_MODE=hybrid and the request carries a bearer token, and the token carries the username claim. Without that claim the request has no user when impersonation is off, and returns 401 when it is on. Requests made with an API key, and every request in open mode, have no user: GET /v1/secrets lists only shared Secrets and creating a personal one returns 403.
The owner is the value of the claim that IMPERSONATION_USERNAME_CLAIM names (default email), without IMPERSONATION_PREFIX. Ark API reads it whether impersonation is on or not, and uses it exactly as the identity provider sends it: Alice@example.com and alice@example.com own different Secrets.
Pick a claim whose value never changes for a user and is never given to someone else, such as sub:
- If the claim value changes for a user, for example after an email change, their personal Secrets stop showing up for them.
- If the identity provider gives the same value to another person, for example an email address reassigned to a new employee, or lets users edit it, that person owns the earlier user’s personal Secrets.
IMPERSONATION_USERNAME_CLAIM is also the username Ark API impersonates, so changing it also changes the Kubernetes RBAC subjects. See claim mapping.
The dashboard offers personal Secrets only when it runs with single sign-on. If the dashboard has a user and Ark API does not see one, creating a personal Secret fails with 403 and the dashboard shows the reason Ark API returned.
Create a personal secret
In the dashboard, open Secrets, select Add secret and pick Personal. Add New next to a secret picker always creates a shared Secret, and the pickers in the Model, MCP server, A2A server and agent forms list only shared Secrets.
With the API, send "scope": "personal". Read the token from a prompt rather than typing it on the command line:
read -rs GITHUB_TOKEN
jq -n --arg token "Bearer $GITHUB_TOKEN" \
'{name: "github", scope: "personal", string_data: {token: $token}}' \
| curl -X POST "$ARK_API/v1/secrets?namespace=default" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d @-Ark stores the Secret under its full name, u-<owner>-github, where <owner> is the first sixteen hex digits of the SHA-256 of the owner’s username, and labels it ark.mckinsey.com/scope=user-<owner>. The response carries the full name, display_name: github and scope: personal. The name you choose can be up to 234 characters long, so that the full name stays within the Kubernetes limit.
The dashboard Secrets page shows each Secret by its display name, with the full name underneath when the two differ, and marks personal ones in the Scope column. Other users do not see your personal Secrets, and GET, PUT or DELETE on one returns the same 404 as a Secret that does not exist.
The full name is not secret. It shows up in every Query that references it, which any user who can read Queries in the namespace sees. The hash is an unsalted SHA-256 of the username, so anyone who can guess the username, such as an email address, can tell whose Secret it is. A claim like sub is harder to guess.
Send a personal secret to an MCP server
Ark API accepts a reference to a personal Secret in one place, and only from its owner: a header of a Query overrides entry with resourceType: mcpserver whose labelSelector selects one MCP server by its name label and nothing else. Reference the Secret by its full name:
overrides:
- resourceType: mcpserver
labelSelector:
matchLabels:
ark.mckinsey.com/name: github
headers:
- name: Authorization
value:
valueFrom:
secretKeyRef:
name: u-0123456789abcdef-github
key: tokenAny other reference to a personal Secret returns 422 when you create or update an Agent, Model, MCPServer, A2AServer, Tool, Memory or Query through Ark API, including Agent overrides, model overrides and query parameters. The 422 body is the same whether the Secret is someone else’s, does not exist or is not an Ark secret. If Ark API cannot read the Secret’s labels, the request returns 500. An update checks the whole spec it writes, so drop such a reference in the same request. Deletes are never blocked. Upgrading lists every case.
The controller, the completions executor and SecretClient.get_secret_value in the Python SDK refuse to resolve a personal Secret anywhere other than a header of a Query mcpserver override. They check the labels, and the completions executor also requires the one-server name selector; none of them checks the owner. Executors that read Secrets another way are not bound by this. A failed resolution shows in the resource’s status or events with the Secret’s name and whether it was not found, is personal or lacks the key, without its value.
Only the completions executor applies the headers of Query mcpserver overrides. Executors built on the Python SDK’s BaseExecutor and ExecutorApp don’t read Query overrides yet, so a personal Secret doesn’t reach an MCP server through them.
If someone deletes a promoted Secret and creates a personal one with the same name, the resources that referenced the promoted Secret stop resolving it. A Query mcpserver override that referenced it resolves the new personal Secret instead.
The header goes to the MCP server with that name, and only if the query’s agents use it. Ark sets the name label on every MCPServer itself, so another server cannot claim the name, and both Ark API and the completions executor refuse any other selector for a personal Secret, such as another label or a matchExpressions. A name that no MCPServer carries fails the query. The header still goes wherever the MCPServer with that name points when the query runs. Anyone who can update that MCPServer’s address, or delete it and create another with the same name, receives every user’s token. That includes users of the dashboard and /v1/mcp-servers, and without impersonation Ark API makes those writes as its service account. Limit who can create and edit MCPServers in namespaces where users keep personal Secrets.
Use personal secrets from the chat
Agent chats in the dashboard show an MCP header overrides panel above the message box when the agent uses an MCP server. Team and model chats do not. Expand it and select Add new to add a row: an MCP server, a header name from the server’s spec.headers or the agent’s own overrides, and a value. With single sign-on the Secret list includes your personal Secrets, marked Personal.
- Personal Secrets can be picked only on a row for one server, not on All MCP servers. Moving a row to All MCP servers clears a personal Secret.
- Every query the chat sends carries the rows as
mcpserveroverrides, one per server, selecting it byark.mckinsey.com/name. They win over the agent’s own value for the same header. - A server that an override cannot select by name is shown but cannot be picked. A server created before the upgrade needs one update first; see Upgrading.
- The chat does not send while a row is incomplete, names a header the server does not have, or repeats a header for the same server or for All MCP servers. The collapsed panel then shows Fix to send.
- Rows belong to that chat panel and stay for every message while it is open. They are not saved in the browser, so closing the panel or reloading the page clears them.
Make a personal secret shared
On a personal Secret’s page, select Make shared. The action is disabled while the form has unsaved changes. It sends the description, alias and labels the page loaded, because the PUT behind it replaces them. The PUT carries no resourceVersion, so changes made elsewhere since the page loaded are overwritten. With the API, send PUT /v1/secrets/{name} with "scope": "shared" and the current description, alias and labels.
The Secret keeps its name and value, and every user in the namespace can then see and reference it. A shared Secret cannot become personal: "scope": "personal" returns 422. The promoted name stays taken, so creating a personal Secret with the same name returns 409.
What personal secrets do not cover
Ark API checks who owns a personal Secret only when a resource is written through it, and only for names that start with u-<owner>-. With kubectl, Helm or GitOps:
- Anyone who can read Secrets in the namespace reads personal ones too. With impersonation on, the Secrets page runs as the signed-in user, who therefore needs
listandgeton Secrets; with cluster access, the same user can read every other user’s personal Secret. Personal Secrets keep users out of each other’s tokens in Ark. They do not separate users who can read Secrets in the namespace. See what the labels protect. - A Query applied with kubectl can send any personal Secret in its namespace through an
mcpserveroverride. The executor checks the labels and the one-server name selector, not who owns the Secret. - A Secret labelled
ark.mckinsey.com/scope=user-<owner>under a name without theu-<owner>-prefix shows up as its owner’s personal Secret, but Ark API does not check references to it, so anyone can send it from a Querymcpserveroverride. - MCPServers created before the upgrade get the name label the next time they are updated, since the controller does not update them by itself, and a server whose name is longer than 63 characters gets none.
- An MCPServer or Model applied with kubectl can name a personal Secret, but it does not resolve.
GET /v1/models?view=with-secretslists the Secrets each Model references, so such a Model shows the personal Secret’s full name there.
The dashboard and Ark API ship together. A dashboard newer than Ark API shows empty scopes and display names.
Reserved names
The API rejects a Secret name that starts with u-, sixteen lowercase hexadecimal digits and a hyphen, such as u-0123456789abcdef-github, with a 422. Ark reserves that prefix for personal Secrets. Don’t use it for Secrets you create with kubectl or GitOps either.
Secrets Ark leaves unlabelled
Some Secrets serve a single Ark feature and stay without the labels, including the ones you create for that feature. Each belongs to the component that reads it:
| Secret | Created by |
|---|---|
| API keys for the Ark API | ark-api, labelled ark.mckinsey.com/api-key |
MCP OAuth tokens, in the Secret an MCPServer names in tokenSecretRef | ark-api during an MCP login, or the controller for machine-to-machine OAuth |
marketplace-source-<name>-auth | ark-api, or you when you seed a source at deploy time |
aigw-sa-credentials (default name) | the ark-tenant chart, read only by the AI gateway token refresh job |
The auth token Secret of an MCP server scaffolded from templates/mcp-server | that server’s Helm chart. Label it in the chart if you want it on the Secrets page |
These stay out of the Secrets page. Manage them through the feature that created them.
What the labels protect
The labels decide what the dashboard and ark-api show and change. They are not access control. Anyone who can read Secrets in the namespace with kubectl, for example through ark-tenant-role, sees every Secret, labelled or not. Restrict that access with Kubernetes RBAC and the other controls of the security layers described in the disclaimer.