Supplying Credentials
Every credential a company uses is a key of a Kubernetes Secret that a field refers to. This guide supplies each one, rotates it, and finds a missing one.
No field accepts the value itself: a model provider’s API key, an agent’s Slack app and a tool server’s token all come from Secrets. Credential Positions is the complete reference: every credential position Crewlet has and the field that fills it.
How a value reaches the engine
Section titled “How a value reaches the engine”- You write a Secret in the object’s namespace. Who writes it does not
matter to the operator:
kubectl, External Secrets, a CSI driver’s synced Secret, or a control plane. - An object refers to one of its keys (
SecretKeyReference,{name, key}) or to the whole Secret (SecretReference,{name}, where the field documents the keys it must hold). - The operator reads the value, pushes it into the company’s engine, into its
encrypted secret store, and writes only the entry’s name into the company
document as
${K8S_…}.
The company document holds only the entry’s name. The value never appears in a pod template, an environment variable, an annotation, a status, an event or a log line. The operator reads Secrets from the API server when it applies a document and does not keep them in its cache.
A Secret must exist before the document that references it can be applied.
Until it does, the next revision waits and the engine keeps running the last
one; the object that references it reports ResolvedRefs=False with the
reason SecretNotFound, naming the Secret and key, and the Company reports
SecretsSynced=False. Create the Secret first, or in the same apply: the
operator waits two quiet seconds before it renders, so objects and Secrets
written together are applied together.
A tool server or a seat’s executor run may go without a value whose key an
optionalKeys list names (the MCPServer’s for a tool server, the Seat’s
spec.sandbox or a setup step’s for a run), the way a pod goes without
an optional secretKeyRef: a missing Secret or key there holds nothing
back, the engine starts the server or the run without the value, and the
object that gives the value names it in its ResolvedRefs=True message, or
the Company, which has no ResolvedRefs, in its SecretsSynced message for
its own setup steps
(A key that may go without its value,
A value a run may go without).
Every other value a server or a run is started with must hold something:
Crewlet starts neither with an empty one.
Each credential
Section titled “Each credential”A model provider’s API key
Section titled “A model provider’s API key”Every model provider is a harness, and its metered key is one key, which
auth.mode: APIKey hands the harness in the variable it reads:
kubectl create secret generic anthropic -n acme --from-literal=apiKey=sk-ant-...apiVersion: crewlet.ai/v1alpha1kind: LLMProvidermetadata: name: anthropicspec: companyRef: {name: acme} harness: ClaudeCode model: claude-sonnet-5 auth: mode: APIKey apiKeySecretRef: {name: anthropic, key: apiKey}A harness holds one sign-in and rotates nothing: a second key is a second
provider, later in a seat’s chain, which the seat falls back to while the
first is out of its limits. Hermes, Pi and OpenCode take their model
provider’s key in env instead, and a subscription’s login is a headless
token or a credential bundle (A harness’s login).
A model the platform provides is declared once on the EngineClass, in
spec.platformLLMProviders, with references that name their namespace:
the Secret stays in the platform’s namespace, which tenants cannot read, and
a Company opts in with spec.llm.usePlatformProviders: true. A platform
provider signs in with a key alone, auth.apiKeySecretRef or a model
provider’s key in env, never a subscription’s login, which is one
account’s.
Embeddings and the code sandbox
Section titled “Embeddings and the code sandbox”spec: # Company embeddings: type: OpenAI model: text-embedding-3-large apiKeySecretRef: {name: openai, key: apiKey} sandbox: setup: - name: npm files: - path: .npmrc valueFrom: secretKeyRef: {name: company-sandbox, key: npmrc}Variables and files the sandbox sets up for every seat’s executor run
(sandbox.setup[].env, sandbox.setup[].files) and a Seat’s own sandbox
variables (Seat.spec.sandbox.env) take valueFrom.secretKeyRef for every
entry.
None of those variables, a Company’s step’s, a Seat’s step’s or the Seat’s
own, may be one Crewlet sets in a box itself: CREWLET_GIT_ACCESS_FILE and
CREWLET_GIT_URL, a box’s access to Gitlet, the engine’s own git host
(Crewlet’s
Repositories on Gitlet),
and CREWLET_CHECK_REPO, CREWLET_CHECK_SHA, CREWLET_CHECK_BASE,
CREWLET_CHECK_NAME, CREWLET_CHECK_ATTEMPT, CREWLET_CHECK_API and
CREWLET_CHECK_SUMMARY, what a check’s box is told of the check it runs
(Crewlet’s
Check boxes).
Crewlet refuses a company document that sets one, and the API refuses it at
the variable’s name. The operator does not offer Gitlet, so no box of its
companies is given those variables, but the names are Crewlet’s all the
same: a variable of your own, such as a token for another git host, takes
another name.
A file’s path is where the seat’s box writes it, relative to the box’s home
(.npmrc, .local/bin/tool) or under ~/ (~/.npmrc). A box writes a file
only inside its home, which Crewlet mints per box, so no absolute path names
it. The API refuses a path of white space alone, an absolute one, one under
another account’s home (~root/…), and one with a backslash after its
leading ~, which a box reads as part of a file name, not a separator.
Crewlet refuses one that names the home itself or a directory above it (~,
..), and one whose .. climbs out of the home: a step of the Company’s own
reports it on the Company as ConfigApplied=False Invalid, and a Seat’s on
the Seat as Applied=False Invalid.
What a coding box carries
Section titled “What a coding box carries”Every agent seat’s executor is its harness’s own run in a box, signed in
by the provider the launch picked: the first of its executor chain that
drives ClaudeCode, Codex, GeminiCLI, QwenCode, OpenCode, CursorAgent, Copilot, Grok, MuseCode, KimiCode, Hermes or Pi,
an LLMProvider or a platform provider (Where a seat’s executor runs).
The engine hands the run the provider’s headless token or its
auth.apiKeySecretRef key, under the variable its harness reads
(CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY, CODEX_API_KEY, GEMINI_API_KEY,
QwenCode’s OPENAI_API_KEY, COPILOT_GITHUB_TOKEN, XAI_API_KEY, META_API_KEY,
KIMI_MODEL_API_KEY), and the provider’s whole
env, beneath the seat’s own variables: an OpenCode, Hermes or Pi provider’s
model provider key, and a gateway’s address (ANTHROPIC_BASE_URL) and the bearer
token it takes (ANTHROPIC_AUTH_TOKEN), or a cloud switch and its region,
which the run reaches its model through as the provider’s other phases do.
Under auth.mode: Env that env is the provider’s whole sign-in, such as
the bearer token.
The box of a provider that signs in with a login (Subscription) is seeded
with it too, its credential files or, for OpenCode, the document OpenCode’s
export printed, from the login on the pod, and writes a refreshed one back
over it, so a credential bundle signs a run in as it signs the provider’s
other phases. A provider under APIKey or Env seeds no login: its key or
its env is the run’s sign-in, and a login beside it is one the run would
not use. The run is a process of the engine pod, as the engine’s user, with
every permission its harness has: it can read its sign-in, and whatever else
that user can on the pod.
The report a run sends back is redacted by the shape of a credential, not by its value. A box holds the sign-in it started with, so rotating the provider’s key reaches a running box only when its next run starts.
A seat that signs Claude Code in itself, with CLAUDE_CODE_OAUTH_TOKEN,
ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN or a CLAUDE_CODE_USE_* toggle
in spec.sandbox.env or a setup step’s env, gets none of the provider’s
sign-in, its token, its key or a sign-in in its env: its own is what the
run uses, as Claude Code ranks its sign-ins by name and a provider’s key
beside a seat’s plan token would win. The rest of the provider’s env, a
gateway’s address among it, still reaches the run, so a seat meant to bypass
the gateway sets ANTHROPIC_BASE_URL itself. A sign-in
the run goes without signs nothing in: one whose value is empty, whether or
not optionalKeys lists its key, one whose Secret or key is missing under a
key optionalKeys lists, and a provisioned one while no Integration of the
company has provisioning: Engine. The run is then given the provider’s
sign-in, as one with no sign-in of its own is. Every other variable of the
provider’s env is added beneath the seat’s variables, so a seat variable of
the same name wins.
An agent’s Slack app
Section titled “An agent’s Slack app”Each agent seat is its own Slack app, so it posts and is mentioned as itself. One Secret per seat, with the two keys Slack issues:
kubectl create secret generic lead-slack -n acme \ --from-literal=botToken=xoxb-... --from-literal=signingSecret=...spec: # Seat lead integrations: slack: enabled: true credentialsSecretRef: {name: lead-slack} # keys botToken, signingSecretThe app’s request URL is in the Seat’s status,
status.integrations.slack.requestURL, as soon as the Company has a Slack
Integration and a public address; it does not depend on the credentials,
so it can go into the app’s manifest before the app exists.
An agent’s GitHub App
Section titled “An agent’s GitHub App”kubectl create secret generic lead-github-app -n acme \ --from-file=privateKey=lead.private-key.pem --from-literal=webhookSecret=...spec: # Seat lead integrations: github: enabled: true permissions: {contents: Read, issues: Write, pullRequests: Write} repos: [acme/widgets] app: id: 1234567 slug: acme-lead installationID: 89012345 credentialsSecretRef: {name: lead-github-app} # keys privateKey, webhookSecretThe webhook URL for the app is status.integrations.github.webhookURL.
permissions are the app’s permissions in GitHub’s terms, each Read or
Write, and a permission left out is No access; the engine narrows every
installation token it issues for the seat to them and to repos. A seat that
has to change CI holds workflows: Write beside contents: Write. GitHub
refuses any push whose commits touch .github/workflows without that
permission, and the same grant lets the seat’s branches run a workflow it
rewrote with the secrets the repository hands its runs, so it is off unless
set. An app registered before the seat was given a permission gains it only
once an owner of the organization accepts the app’s new permissions at
GitHub; until then the engine reports the seat’s access as short of what its
Seat asks (An agent’s access).
The company’s GitHub organization
Section titled “The company’s GitHub organization”apiVersion: crewlet.ai/v1alpha1kind: Integrationmetadata: name: githubspec: companyRef: {name: acme} github: webhookSecretRef: {name: acme-github, key: webhookSecret} tokenSecretRef: {name: acme-github, key: orgToken}An agent’s Mattermost bot
Section titled “An agent’s Mattermost bot”Each agent seat speaks on Mattermost as its own bot, whose one token covers everything it does there:
spec: # Seat lead integrations: mattermost: enabled: true roles: [SystemUser] botToken: secretKeyRef: {name: lead-mattermost, key: botToken}The other integrations
Section titled “The other integrations”GitLab’s signing token and read token, Jira’s and Confluence’s administrator
tokens and webhook secrets, Datadog’s webhook token and organization keys,
Cloudflare’s provisioner token, Scaleway’s provisioner key, Google Cloud’s
federation key and sign-in client secret, AdMob’s and AdSense’s OAuth client
secret (one Secret key may serve every Google sign-in), each App Store Connect
team key’s private key, each Apple Ads API
user’s private key, Meta Ads’ app secret and system user tokens, and the
administrator credentials
the engine creates the seats’ accounts with are each a SecretKeyReference
of the vendor’s Integration;
Connecting integrations shows every one.
Credentials the engine provisions
Section titled “Credentials the engine provisions”Under an Integration with provisioning: Engine, the engine creates the
account of each agent seat that is on the vendor and mints its credential
itself, into its own secret store, under a name it gives it for the seat. At
Expo a person adds the seat’s robot and pastes its token on the dashboard, and
at DigitalOcean a person creates the seat’s personal access token and pastes
it, which the engine checks and seals the same way. At AWS the engine seals
nothing: it issues the seat’s session at use and writes it to the seat’s box
itself, so no Seat names an AWS value. No Secret holds that value, and the
engine hands it to the vendor’s tool server itself, so the Seat names none of
that vendor’s. The credentials an integration’s own CLIs read in the box
(GitLab’s, Expo’s and DigitalOcean’s token, Scaleway’s key, GitHub’s app
token) are not named: the engine puts them in an agent’s box itself while the
seat is on, and a provisioned line under the same name is ignored for it and
reported as an advisory (An agent’s own integration
credentials).
A seat’s executor runs, which get no tool server’s environment, name any other
one in spec.sandbox.env as provisioned:
spec: # Seat lead sandbox: env: - name: DD_APP_KEY valueFrom: provisioned: {vendor: Datadog, field: AppKey}The engine rotates and heals it; the operator never writes, rewrites or deletes it. Credential Positions says how it is named.
A harness’s login
Section titled “A harness’s login”A provider signs its harness in with a headless subscription token or with a
credential bundle crewlet llm export wrote (for OpenCode, its exported
login: An OpenCode login in a bundle),
each a Secret key; with auth.mode: APIKey, with the key of
auth.apiKeySecretRef; or, for Hermes, Pi and OpenCode, with its model
provider’s key in env, which may never set the harness’s own token or key
variable, since auth owns it, nor a variable the engine sets to keep the
harness inside its seat’s home (Signing in):
spec: # LLMProvider claude-code harness: ClaudeCode model: sonnet auth: tokenSecretRef: {name: claude-subscription, key: oauthToken} env: - name: HTTPS_PROXY # every variable comes from a Secret valueFrom: secretKeyRef: {name: claude-subscription, key: proxy}Running seats on a harness says which to use.
A tool server’s token
Section titled “A tool server’s token”An MCPServer shared by every seat takes its credentials as environment
variables (Stdio) or headers (HTTP), each from a Secret:
spec: # MCPServer linear transport: HTTP url: https://mcp.linear.app/mcp headers: - name: Authorization valueFrom: secretKeyRef: {name: linear, key: authorization} # "Bearer lin_api_..."A server with shared: false starts one instance for each agent seat it
reaches (its access,
Choosing which agents get a server),
and each Seat (or the Unit it is in) brings its own credentials for it in
spec.mcp, which hands them over and grants nothing:
spec: # Seat lead mcp: - name: github # the MCPServer's name env: - name: Authorization valueFrom: secretKeyRef: {name: lead-github, key: authorization}Crewlet treats every value of a tool server’s env and headers, and every
value a seat gives it, as a credential, and cannot tell a setting from one; the
name can. A setting that is no credential, such as an address, a switch or a
seat’s own cache path, is written out as value instead, under any name
that does not say it holds a credential: the API refuses a value under a
name with a part such as TOKEN, KEY, SECRET or PASSWORD, and under the
Authorization, Proxy-Authorization and Cookie headers
(Settings and credentials has
the rule). The other lists of variables a credential goes in, a sandbox’s,
its setup steps’ and a harness’s, take no literal value.
A remote server the company signs in to with OAuth (spec.oauth) takes no
token from a Secret at all: an administrator signs in from the engine’s
dashboard, and the grant stays in the engine’s own store, which the operator
neither writes nor reads; or the engine signs in as a service identity, and
holds the tokens it is issued in its memory alone. The one credential of
such a server the operator pushes is the secret of the company’s own client:
for a person’s sign-in where the vendor issued it as confidential, and
always for a service identity (grant: ClientCredentials), which signs in
with it:
spec: # MCPServer tickets oauth: client: Own clientID: crewlet-nimbus clientSecret: secretKeyRef: {name: tickets-oauth, key: clientSecret}Signing in with OAuth and Signing in as a service identity have the rest.
What the platform supplies
Section titled “What the platform supplies”An EngineClass may reference Secrets in the platform’s own namespace for the
engine’s pods: telemetry headers (telemetry.headersSecretRef) and
class-wide environment variables (podTemplate.spec.env[].valueFrom). The
operator copies those values into the Secret it owns in each company’s
namespace for the engine’s pod (<company>-bootstrap), because a pod can
read only Secrets in its own namespace.
The keys of a class’s S3 bucket are each company’s own, in its namespace:
apiVersion: v1kind: Secretmetadata: {name: acme-objects, namespace: acme}stringData: accessKeyID: AKIA... # a key whose policy admits the company's prefix only secretAccessKey: ...---# Company acmespec: objects: credentialsSecretRef: {name: acme-objects}Issue them per company, with a policy that admits only the company’s prefix
of the bucket (the class’s objects.s3.prefix, expanded): a key the class
shared would let every tenant read and write every other tenant’s files,
because whatever reaches an engine pod reaches code the tenant runs there. Neither key may hold a ${NAME} reference: the
operator writes both into the engine’s crewlet.yaml as they are, where
Crewlet replaces every reference with a value of the pod’s environment, so
it holds the pods back with RuntimeReady=False ObjectCredentialsInvalid,
naming the Secret and the key, until the key holds none. A Company’s own
spec.runtime.env reads Secrets in its namespace directly.
Rotating a credential
Section titled “Rotating a credential”Write the new value into the same Secret and key. The operator sees the change and pushes the new value into the engine’s secret store, every value that changed in one write, and the engine activates the revision it runs again with the new values, once, because it reads a value only when a revision activates. The operator records that revision as its own; where the engine made none, it applies a revision with the same document itself, whose summary names the Secret. The engine does not restart and no seat loses its conversation.
kubectl create secret generic anthropic -n acme --from-literal=apiKey=sk-ant-new... \ --dry-run=client -o yaml | kubectl apply -f -kubectl get company acme -n acme -o jsonpath='{.status.config.revisionID}{"\n"}'A change that leaves every referenced value as it was (a label, an annotation, another key nothing references) writes nothing.
The new value reaches the engine even while it refuses the rendered
document (ConfigApplied=False, say for a seat somebody holds): no revision
of the document is written then, but the revision the engine runs is
activated again, unchanged, with a Reactivated event naming the store
entry, as long as that revision uses the value: the engine does so itself
as the value is written, and the operator asks for it where the engine’s
activation failed. A Warning SecretRefreshFailed says it could not, and
when it tries again.
To rotate a provider’s key without a moment where the vendor refuses the one in use, mind the order: write the new key into the Secret, wait for the revision that carries it, and only then revoke the old key at the vendor. Every harness call after that revision is handed the new key. A seat’s executor run holds the key it started with and never rotates it (What a coding box carries), so for a provider a seat’s executor runs on wait too for the runs already going to end before you revoke.
A provider’s auth.credentialBundleSecretRef is an exception. The
engine restores a bundle, when it starts and at every revision it applies,
only into a login that is empty or that was installed before the bundle’s
own login, by the install record each carries, and a refresh keeps its
login’s record: so a bundle of the login the provider holds on the data
volume reaches nothing, and that refreshed login is the one to keep
(Signing in), while one crewlet llm export
wrote after a new login replaces it the next time the engine starts or
applies a revision. To move a provider onto a new bundle at once, give it,
and every provider sharing its login, a new loginName: its login directory
is then empty, and the revision that moves it restores the bundle there,
with no restart. The old directory’s
login and seat homes stay on the data volume. A bundle belongs to the harness it
was exported from: after a provider moves to another harness, the new harness’s
login is empty, and the bundle in the Secret is refused there until it holds
one exported from the new harness (Signing in).
What the engine reads when it starts is the other exception. The values in its
crewlet.yaml (the API tokens, the keyring, the Company’s object-store keys,
the class’s telemetry headers and env values) are read once: the operator
watches the Secrets they come from and rolls the data pod when one changes.
A Secret a Company’s spec.runtime.env references is not watched; restart
the data pod after changing it
(kubectl rollout restart statefulset/<company>-data).
The engine’s own Secrets
Section titled “The engine’s own Secrets”The operator generates two Secrets for every company and never rewrites them:
<company>-keyring: the keys that seal the engine’s secret store. WithdeletionPolicy: Retainit outlives the Company along with the data volume, since neither is readable without the other. A platform may supply it instead (an ExternalSecret, say): a Secret of that name that another controller owns is used as it is. Its annotationcrewlet.ai/active-key-idnames the key that seals new writes.<company>-api-tokens: the operator’s own token and the one for the company’s consumers, which is also published, with the API’s address, in the Secretstatus.apiAccessSecretRefnames. A platform may supply this one too; each token must be at least 43 characters of base64, base64url or hex (32 random bytes:openssl rand -base64 32), or the pod is held back withRuntimeReady=False APITokensInvalid.
Deleting the tokens Secret makes the operator generate new tokens and roll
the data pod; consumers then read the new one from the access Secret. The
tokens keep their ids, and Crewlet keeps a dashboard session opened with a
token by its id rather than its value, so a session opened with the old
access token lasts out its hour; sign in with the new token and sign out
everywhere to end those sooner
(Rotating the access token). A
rotation does not undo what a leaked token did: it holds admin, so it could
read and replace every value in the engine’s secret store and add people and
service accounts, and each needs its own clean-up
(If the access token leaked). Never
delete the keyring of a company that has data: the values sealed with it
cannot be read without it.
Rotating the keyring is not supported in v1alpha1. Crewlet rotates a key by
adding the new one, making it active, re-sealing both its secret store and
its stored company configuration under it (crewlet secrets rekey and
crewlet config rekey), and only then dropping the old one; the operator
runs none of those steps, and a key removed before the re-seal leaves
whatever it sealed unreadable. No engine boots while its secret store holds
a value its keyring cannot open, so such a removal stops every data pod and
seat pod of the company, each restarting until the key is back in
<company>-keyring
(The data pod is not ready).
Adding a key to the Secret is safe (the pod rolls onto a keyring that opens
everything it did); removing one is not.
Adding a key and making it active (crewlet.ai/active-key-id) in one edit
is safe as well. A seat pod joins the company’s event stream presenting a
key derived from its keyring’s active key, and a data pod admits only the
keys of the keyring it started with, but the operator moves the seat pods
onto a new keyring only once every data pod is ready on it: until then they
present the key that was active, which the data pods still hold, and after
it the new one, which every data pod already holds. An edit that removes the
key the seat pods present, making another active, does cut them off for a
while, when the data pods boot on it at all: the data pods roll onto a
keyring without that key and refuse each seat pod until it, too, has rolled
onto the new keyring
(Seat pods do not run).
When a credential does not arrive
Section titled “When a credential does not arrive”| You see | It means |
|---|---|
ResolvedRefs=False SecretNotFound on an object, SecretsSynced=False SecretNotFound on the Company | The Secret or the key is missing in the object’s namespace. The message names both. |
SecretTooLarge | The value is over the 64 KiB the engine’s secret store accepts. |
SecretsSynced=False EngineUnavailable | The values could not be written to the engine; the message says why. The operator retries. |
SecretsSynced=Unknown NotManaged | The management policy keeps the operator out of the engine’s secret store (Observe, and Seed once seeded). |
RuntimeReady=False SecretNotFound | A Secret the EngineClass references for the pods is missing in the platform’s namespace, or the Company’s spec.objects.credentialsSecretRef is. |
RuntimeReady=False ObjectCredentialsInvalid | A key of the Company’s spec.objects.credentialsSecretRef holds a ${NAME} reference, which Crewlet would replace from the pod’s environment; the message names the Secret and the key. |
RuntimeReady=False APITokensInvalid | A supplied <company>-api-tokens lacks a token or holds one the engine should not be guarded by; the message says which. |
Integration Healthy=False CheckFailed | The engine reached the vendor and the credential did not work; the message carries the vendor’s answer. |
ResolvedRefs=False SecretValueEmpty | A Secret key the object gives a tool server or a seat’s executor run holds an empty value, under a key no optionalKeys lists: the object is applied, and the engine does not start the server, or starts each run without the value, until the key holds a value. The message names the Secret, the key, the variable, and the optionalKeys that could list it where Crewlet offers one: never for a Seat’s or a Unit’s value for a tool server, the identity the seat’s instance acts as. The Company’s own setup steps say it in SecretsSynced. |
Seat ResolvedRefs=False NoProvisioner | The Seat names a provisioned credential, and no Integration of its company has provisioning: Engine to create it. The seat is applied; until one does, the engine starts none of its tool servers that take the value, unless the MCPServer’s optionalKeys lets them go without it, and its executor runs and its chat app run without it. |
Troubleshooting lists every condition.
See also
Section titled “See also”- Credential Positions — every position, and who can read a value
- Connecting Integrations — each vendor’s credentials
- Troubleshooting —
SecretNotFoundand the other reasons
Part of Crewlet. Generated from crewlet/crewlet-operator main at 5aacd1b.