Secrets & Environment¶
Plain Environment Variables¶
Secret References (secretEnv)¶
Reference a secret that belongs to another component (e.g., the PostgreSQL component creates its own secret):
component— the name of the component that owns the secret (e.g.,dbfor PostgreSQL)key— the specific key within that secret
Reference an Existing Kubernetes Secret¶
If the secret already exists in the cluster:
Use name (not component) for pre-existing secrets.
Inline Secrets¶
Create secrets alongside your app:
from helm_me import app, secret, secret_ref, web, image, Reconcile
spec = app(
name="my-app",
secrets=[
secret(
name="app-credentials",
strings={"OPENAI_API_KEY": "sk-..."},
reconcile=Reconcile.APPLY,
)
],
components=[
web(
name="backend",
image=image("myapp:latest"),
port=8000,
secret_refs={"OPENAI_API_KEY": secret_ref("app-credentials", "OPENAI_API_KEY")},
)
],
)
Warning
Inline secret values are stored in plain text in the spec file. For production, use external secret management and reference existing secrets by name.
Service References (serviceEnv)¶
Inject another component's hostname automatically:
This injects the Kubernetes service hostname (e.g., myapp-cache) or host:port format.