# Environment Variables

> Inject variables, secure secrets, and manage runtime configurations.

- **Category**: Deploy & Configure
- **Last Verified**: 2026-07-14

Kubeletto allows configuring environment variables per-service or at the project level. Setting variables triggers a zero-downtime rolling update.

## 1. Set Env Vars via CLI

```bash
kubeletto env set my-service KEY=VALUE OTHER_KEY=OTHER_VALUE
```

## 2. Secure Secrets

To encrypt sensitive configurations (like database strings or API tokens), use the `--secret` option. Secrets are write-only and masked in CLI listings:

```bash
kubeletto env set my-service DATABASE_URL="postgres://..." --secret
```

## 3. Bulk Loading from .env

You can load variables from a local text file:

```bash
kubeletto env set my-service --file .env.production
```

## Reserved Variables

The system automatically reserves and injects these variables. Do not overwrite them:

| Variable Name | Description |
| --- | --- |
| PORT | The port the application must bind to (injected by Knative). |
| KUBELETTO_SERVICE_NAME | Name of the running Kubeletto service. |
| KUBELETTO_SERVICE_ID | Unique ID of the service. |
| KUBELETTO_DEPLOYMENT_ID | ID of the active deployment revision. |

