CLI

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:

bash
kubeadapt --config /path/to/config.yaml get clusters

Format

yaml
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:

bash
chmod 0600 ~/.kubeadapt/config.yaml

Environment variables

Environment variables override values in the config file.

VariableConfig KeyDescription
KUBEADAPT_API_URLapi_urlAPI base URL
KUBEADAPT_API_KEYapi_keyAPI key for authentication

Precedence

When the same setting is defined in multiple places, this order applies (highest to lowest):

  1. Command-line flags (--api-key, --api-url)
  2. Environment variables (KUBEADAPT_API_KEY, KUBEADAPT_API_URL)
  3. Config file (~/.kubeadapt/config.yaml)
  4. 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.