1:1 mentoring with Big Tech AI engineers
System Design

Config and Secrets

Keep model keys out of images, browsers and logs: validate at boot that a credential resolves, federate pods and CI instead of storing keys, and give each environment its own workspace and limits.

Last updated

Production10 min readBuilds onService and Container
What you’ll learn
  • Validate at boot that a credential resolves, and say why a missing variable is the wrong test
  • Trace a federated token exchange and name the two traps that break it
  • Choose where each credential may live and give each environment its own workspace
27

Config and Secrets

Keep keys out of images, browsers and logs; check credentials at boot.

Key idea

Config says how the service behaves; a secret opens the till. Federate: the pod holds an identity, not a key.

No key anywhere: the pod trades its identity for a token that expires
a key in browser code: anyone can read it in the page source BrowserYour backend podModel APIPlatform issuerAnthropic token endpoint holds no credentialcalls your backend holds an identity, not a keyANTHROPIC_API_KEY unset Messages APIchecks the bearer token Kubernetes, Google Cloud metadata,or GitHub Actions OIDC matches your federation rule (fdrl_…)token lifetime: 3,600 s by default 4 · Bearer token 1 · signed JWT2 · JWT + IDs 3 · short-lived token on every request mounted as a filea fresh JWT each time refreshed 120 s before expiry The browser holds nothing, the pod an identity, each request a token that expires. No key is stored.

Blue: request. Teal: your backend, its pod identity and the tokens it trades. Amber: the model. Grey: the platform and the token endpoint. Dashed: the path that must not exist.

Related

More in System Design

Get full access to all 151 sections with code examples, diagrams, and interactive animations.

Unlock Premium