CLI Configuration
Configure kubeadapt with a YAML config file, environment variables, or command-line flags. Includes precedence rules and file permission details.
kubeadapt reads configuration from three sources: a YAML config file, environment variables, and command-line flags. When the same setting appears in multiple places, the highest-precedence source wins.
Config file
The default config file location is ~/.kubeadapt/config.yaml. You can point to a different file with the --config flag:
kubeadapt --config /path/to/config.yaml get clustersFormat
api_url: "https://public-api.kubeadapt.io"
api_key: "ka_your_api_key"File permissions
The config file is created automatically when you run kubeadapt auth login. It's written with 0600 permissions so only the file owner can read or write it. The ~/.kubeadapt/ directory is created with 0700 permissions.
If you create the file manually, set the permissions yourself:
chmod 0600 ~/.kubeadapt/config.yamlEnvironment variables
Environment variables override values in the config file.
| Variable | Config Key | Description |
|---|---|---|
KUBEADAPT_API_URL | api_url | API base URL |
KUBEADAPT_API_KEY | api_key | API key for authentication |
Precedence
When the same setting is defined in multiple places, this order applies (highest to lowest):
- Command-line flags (
--api-key,--api-url) - Environment variables (
KUBEADAPT_API_KEY,KUBEADAPT_API_URL) - Config file (
~/.kubeadapt/config.yaml) - Defaults (API URL defaults to
http://localhost:8002)
For example, if api_url is set in your config file but you also export KUBEADAPT_API_URL, the environment variable takes effect. If you then pass --api-url on the command line, that takes effect over both.
Related
- Authentication: login, logout, and credential storage
- Command Reference: all available commands and flags