Skip to content

CLI Reference

Complete reference for all LoKO commands.

Most runtime commands resolve their target environment in this order:

  1. --config / -c if you pass it explicitly
  2. the active environment from inventory
  3. ./loko.yaml

This means commands like loko status, loko env start, loko env stop, loko env destroy, loko workloads ..., loko dns ..., loko tunnel ..., and loko gitops ... can work from outside the project directory after you activate an environment.

Most commands that operate on an existing environment, including most config ... commands, follow this same order. Commands that create or generate config files still act on the local file you point them at.

  • env - Environment lifecycle
  • workloads - Workload management
  • aws - AWS profile helper for local AWS-compatible workloads
  • doctor - Aggregated diagnostics
  • check - Health checks and diagnostics
  • certs - Certificate and CA management
  • dns - DNS management
  • config - Configuration management
  • helm - Helm repository management
  • secrets - Credentials management
  • registry - Container registry operations
  • tunnel - Tunnel management
  • logs - Log viewing
  • inventory - Inventory management
  • state - Persisted state tooling
  • catalog - Catalog management
  • gitops - GitOps bootstrap and lifecycle

Create complete environment.

Terminal window
loko env create [OPTIONS]

Options:

  • --config, -c TEXT - Config file path (default: loko.yaml)

Example:

Terminal window
loko env create
loko env create -c loko-prod.yaml

Start stopped environment.

Terminal window
loko env start [OPTIONS]

Stop running environment.

Terminal window
loko env stop [OPTIONS]

Activate another environment.

Terminal window
loko env activate ENV_NAME [OPTIONS]

Stops the current environment, switches the current kubectl context, starts the target environment, and marks it as the active environment in inventory.

Notes:

  • The target environment must already exist in inventory
  • The target cluster must already be created
  • Top-level alias: loko activate ENV_NAME

List environments known to LoKO inventory.

Terminal window
loko env list [OPTIONS]

This is an alias for loko inventory list.

Show the data directory for an environment.

Terminal window
loko env show [ENV_NAME]

If ENV_NAME is omitted, LoKO uses the active environment.

Open the environment data directory in the default file manager.

Terminal window
loko env browse [ENV_NAME]

If ENV_NAME is omitted, LoKO uses the active environment.

Destroy cluster but keep configs.

Terminal window
loko env destroy [OPTIONS]

If no explicit --config is given, this targets the active environment first.

Destroy and recreate environment.

Terminal window
loko env recreate [OPTIONS]

Remove all environment artifacts.

Terminal window
loko env clean [OPTIONS]

Options:

  • --keep-config - Keep loko.yaml file

List workloads.

Terminal window
loko workloads list [OPTIONS]

Options:

  • --all - Show all workloads including disabled
  • --user - Show user workloads only
  • --system - Show system workloads only
  • --internal - Show internal components only
  • --disabled - Show disabled workloads only
  • --format TEXT - Output format: rich, json, text

Examples:

Terminal window
loko workloads list
loko workloads list --system --disabled
loko workloads list --format json | jq

Add workload from catalog.

Terminal window
loko workloads add WORKLOAD_NAME [OPTIONS]

Options:

  • --enabled / --disabled - Enable or disable the workload in config
  • --now - Deploy immediately after adding

Examples:

Terminal window
loko workloads add postgres
loko workloads add postgres --now
loko workloads add rabbitmq --disabled

Remove workload from config.

Terminal window
loko workloads remove WORKLOAD_NAME [OPTIONS]

Options:

  • --now - Undeploy immediately before removing

Enable workload.

Terminal window
loko workloads enable WORKLOAD_NAMES... [OPTIONS]

Options:

  • --now - Deploy immediately

Examples:

Terminal window
loko workloads enable postgres
loko workloads enable mysql postgres mongodb --now

Disable workload.

Terminal window
loko workloads disable WORKLOAD_NAMES... [OPTIONS]

Options:

  • --now - Undeploy immediately

Examples:

Terminal window
loko workloads disable postgres
loko workloads disable mysql postgres mongodb --now

Deploy workloads.

Terminal window
loko workloads deploy [WORKLOAD_NAMES...] [OPTIONS]

Options:

  • --all - Include internal components
  • --user - User workloads only
  • --system - System workloads only
  • --internal - Internal components only

Examples:

Terminal window
loko workloads deploy # All enabled
loko workloads deploy postgres # Specific workload
loko workloads deploy mysql postgres # Multiple workloads
loko workloads deploy --system # All system workloads

Undeploy workloads.

Terminal window
loko workloads undeploy [WORKLOAD_NAMES...] [OPTIONS]

Options: Same as deploy

Run a full helmfile sync for workloads and GitOps when enabled.

Terminal window
loko workloads sync [OPTIONS]

Re-generates the workloads helmfile and runs a full sync. If GitOps is enabled, it also syncs the GitOps provider.

Show workload catalog information.

Terminal window
loko workloads info WORKLOAD_NAME

Example:

Terminal window
loko workloads info postgres

Show workload endpoints.

Terminal window
loko workloads endpoints WORKLOAD_NAME [OPTIONS]

Options:

  • --format TEXT - Output format

Show connection strings.

Terminal window
loko workloads connect WORKLOAD_NAME [OPTIONS]

Options:

  • --show-password, -p - Display actual passwords

Run health checks.

Terminal window
loko workloads check WORKLOAD_NAME [OPTIONS]

Options:

  • --tier, -t TEXT - Health check tier: infrastructure (default), client, or all
  • --all, -a - Run all health checks regardless of tier
  • --port-forward, -f - Use kubectl port-forward

View workload logs.

Terminal window
loko logs workload WORKLOAD_NAME [OPTIONS]

Options:

  • --follow, -f - Follow log output
  • --tail INTEGER - Lines to show from end
  • --since TEXT - Show logs since (e.g., 5m, 1h)
  • --container TEXT - Container name (for multi-container pods)
  • --previous - Show previous container logs

Examples:

Terminal window
loko logs workload postgres
loko logs workload postgres --follow --tail 100
loko logs workload traefik --container traefik

Show the unified LoKO AWS CLI profile and per-service endpoints for enabled AWS-compatible workloads.

Terminal window
loko aws profile [OPTIONS]

The generated profile name is loko-<environment-name> (for example, loko-dev-me).

Includes endpoints for enabled workloads:

  • garage → S3 (https://garage.${LOKO_DOMAIN})
  • elasticmq → SQS (https://elasticmq-api.${LOKO_DOMAIN})
  • goaws → SNS (https://sns.${LOKO_DOMAIN})
  • dynamodb-local → DynamoDB (https://dynamodb-local.${LOKO_DOMAIN})

Examples:

Terminal window
loko aws profile
loko aws profile -c loko.yaml
# Then use AWS CLI with the printed profile
aws s3 ls --profile loko-dev-me
aws sqs list-queues --profile loko-dev-me
aws sns list-topics --profile loko-dev-me
aws dynamodb list-tables --profile loko-dev-me

Show DNS container status and configuration.

Terminal window
loko dns status [OPTIONS]

Start DNS container.

Terminal window
loko dns start [OPTIONS]

Stop DNS container.

Terminal window
loko dns stop [OPTIONS]

Recreate DNS container with updated configuration.

Terminal window
loko dns recreate [OPTIONS]

Show global CA certificate info: path, subject, expiry dates, and SHA-256 fingerprint.

Terminal window
loko certs ca status [OPTIONS]

Example:

Terminal window
loko certs ca status

Install (or re-install) the global LoKO CA into all system trust stores and Docker certs.d.

Installs into: macOS Keychain or Linux trust store, NSS databases (Firefox), Java cacerts (if JAVA_HOME is set), and ~/.docker/certs.d/<registry>/ca.crt.

Terminal window
loko certs ca install [OPTIONS]

Use this when:

  • Setting up on a new machine with an existing ~/.loko/ca/
  • Trust was accidentally removed from the keychain
  • Adding a new environment whose registry needs Docker trust

Example:

Terminal window
loko certs ca install

Remove the global LoKO CA from all trust stores, Docker certs.d for all known environments, and (by default) delete the CA files from ~/.loko/ca/.

Terminal window
loko certs ca remove [OPTIONS]

Options:

  • --keep-files - Remove trust only; do not delete ~/.loko/ca/

Examples:

Terminal window
loko certs ca remove # Remove trust and delete CA files
loko certs ca remove --keep-files # Remove trust only

Destroy the current global CA, generate a new one (10-year validity, 4096-bit RSA), and reinstall trust. All existing per-environment wildcard certificates are invalidated and must be renewed.

Terminal window
loko certs ca regenerate [OPTIONS]

After regenerating, renew each environment’s wildcard cert:

Terminal window
loko certs renew

Show wildcard certificate info for the current environment: SANs, expiry dates, issuer, and SHA-256 fingerprint.

Terminal window
loko certs show [OPTIONS]

Renew the wildcard certificate for the current environment using the existing global CA. Automatically updates the Kubernetes wildcard-tls secret and restarts Traefik.

Terminal window
loko certs renew [OPTIONS]

Use this when:

  • The wildcard cert has expired or is approaching expiry
  • The global CA was regenerated (certs ca regenerate)
  • New SANs are needed (e.g. after enabling a workload with a wildcard subdomain)

List environments known to inventory.

Terminal window
loko inventory list [OPTIONS]

Options:

  • --verbose, -v - Show base directory, Kubernetes version, and node count
  • --format TEXT - Output format: rich, json, text

The output marks which environment is currently active.

Validate inventory health.

Terminal window
loko inventory check [OPTIONS]

Detects missing configs, missing base directories, missing clusters, duplicate environment names, and stale active-environment markers.

Remove stale entries from inventory.

Terminal window
loko inventory vacuum [OPTIONS]

Options:

  • --dry-run - Preview stale entries without removing them

When safe, this also removes stale resolver files for domains no longer used by any remaining inventory entry.

Bootstrap GitOps for the current environment.

Terminal window
loko gitops init [OPTIONS]

Options:

  • --provider [fluxcd|argocd] - GitOps provider (default: fluxcd)
  • --org TEXT - Forgejo organization owner for repos
  • --force - Overwrite existing non-empty GitOps repo
  • --verbose - Show underlying command output

Show GitOps health and reconciliation state.

Terminal window
loko gitops status [OPTIONS]

Options:

  • --json - Machine-readable output

Remove GitOps bootstrap resources and integration state.

Terminal window
loko gitops destroy [OPTIONS]

Options:

  • --force - Skip confirmation prompt
  • --dry-run - Show actions without making changes

Trigger immediate reconciliation of the root GitOps construct.

Terminal window
loko gitops reconcile [OPTIONS]

For FluxCD: annotates FluxInstance, Kustomization/loko-root, and GitRepository/loko-gitops. For ArgoCD: patches Application/loko-root to trigger a sync.

Destroy and re-initialize GitOps (keeps gitops.enabled: true).

Terminal window
loko gitops reset [OPTIONS]

Options:

  • --provider [fluxcd|argocd] - Provider to use after reset
  • --org TEXT - Forgejo organization for the repository
  • --force - Skip confirmation prompt
  • --verbose - Show underlying command output

Enable GitOps in loko.yaml.

Terminal window
loko gitops enable [OPTIONS]

Options:

  • --now - Bootstrap immediately
  • --provider, -p [fluxcd|argocd] - Provider to apply with --now
  • --org, -o TEXT - Forgejo organization to use with --now
  • --force, -f - Overwrite existing repository if not empty when using --now
  • --verbose, -v - Show detailed underlying command output when using --now

Disable GitOps in loko.yaml.

Terminal window
loko gitops disable [OPTIONS]

Options:

  • --now - Destroy GitOps resources immediately

Show or set the configured GitOps provider.

Terminal window
loko gitops provider [fluxcd|argocd]

If no argument is passed, prints the current provider.

Check if all required tools are installed.

Terminal window
loko check prerequisites [OPTIONS]

Check DNS configuration and resolution status.

Terminal window
loko check dns [OPTIONS]

Check availability of all configured ports.

Terminal window
loko check ports [OPTIONS]

Check terminal capabilities for rich output.

Terminal window
loko check terminal

Run aggregated diagnostics across runtime, state, cluster, and workloads.

Terminal window
loko doctor [OPTIONS]

Options:

  • --config, -c TEXT - Configuration file path [default: loko.yaml]

Show persisted state status and coverage.

Terminal window
loko state status

Run consistency checks for current persisted state.

Terminal window
loko state doctor

Show latest lifecycle operations from the persisted journal.

Terminal window
loko state operations [OPTIONS]

Options:

  • --env TEXT - Filter by environment name
  • --command TEXT - Filter by command (e.g., create, recreate)
  • --status TEXT - Filter by status (running, completed, failed)
  • --limit INTEGER - Maximum operations to show (1-100, default 10)
  • --steps - Include detailed step rows

Show detailed step-by-step view for one operation.

Terminal window
loko state operation OPERATION_ID

Export state snapshot (inventory + secrets + metadata).

Terminal window
loko state export [OPTIONS]

Options:

  • --output, -o TEXT - Output snapshot path, or - for stdout [default: -]

Import state snapshot.

Terminal window
loko state import --input SNAPSHOT_PATH [OPTIONS]

Options:

  • --input, -i TEXT - Snapshot file path (required)
  • --replace / --merge - Replace existing state or merge into it (default: replace)

Generate configuration file.

Terminal window
loko config generate [OPTIONS]

Options:

  • --force - Overwrite existing file
  • --local-ip TEXT - Override auto-detected local IP
  • --output, -o TEXT - Output file path [default: loko.yaml]

Example:

Terminal window
loko config generate
loko config generate --local-ip 192.168.0.10
loko config generate --force --output custom.yaml

Validate configuration file.

Terminal window
loko config validate [OPTIONS]

Sync configuration changes.

Terminal window
loko config sync [OPTIONS]

Options:

  • --backup / -b - Create backup before applying changes
  • --diff / --no-diff - Show or hide detailed diffs

Upgrade component versions.

Terminal window
loko config upgrade [OPTIONS]

Detect local IP address.

Terminal window
loko config ip

Add Helm repository.

Terminal window
loko helm repo add [OPTIONS]

Options:

  • --helm-repo-name TEXT - Repository name (required)
  • --helm-repo-url TEXT - Repository URL (required)

Example:

Terminal window
loko helm repo add \
--helm-repo-name bitnami \
--helm-repo-url https://charts.bitnami.com/bitnami

Remove Helm repository.

Terminal window
loko helm repo remove [OPTIONS]

Options:

  • --helm-repo-name TEXT - Repository name (required)

List Helm repositories.

Terminal window
loko helm repo list [OPTIONS]

Web UI workloads are managed as regular workloads through the workloads commands. Many workloads have linked UI tools that can be added separately.

Use loko workloads info to see linked UI workloads:

Terminal window
loko workloads info postgres
# Shows: postgres-ui (pgAdmin) as a linked workload

UI workloads use the same commands as other workloads:

Terminal window
# Add a UI workload
loko workloads add postgres-ui
# Deploy a UI workload
loko workloads deploy postgres-ui
# Remove a UI workload
loko workloads remove postgres-ui

See the Workloads section for all available commands.

Fetch secrets from cluster.

Terminal window
loko secrets fetch [OPTIONS]

Display saved secrets.

Terminal window
loko secrets show [OPTIONS]

Options:

  • --format TEXT - Output format: rich, json, text

Examples:

Terminal window
loko secrets show
loko secrets show --format json | jq '.postgres.password'

Show registry status.

Terminal window
loko registry status [OPTIONS]

List repositories.

Terminal window
loko registry list-repos [OPTIONS]

Show repository details.

Terminal window
loko registry show-repo REPOSITORY_NAME [OPTIONS]

List repository tags.

Terminal window
loko registry list-tags REPOSITORY_NAME [OPTIONS]

Delete all tags from a specific repository.

Terminal window
loko registry purge-repo REPOSITORY_NAME [OPTIONS]

Options:

  • --force, -f - Skip confirmation prompt

Example:

Terminal window
loko registry purge-repo myapp --force

Delete all tags from every repository in the registry.

Terminal window
loko registry purge [OPTIONS]

Options:

  • --force, -f - Skip confirmation prompt

Load locally built image(s) into the Kind cluster.

Terminal window
loko registry load-image IMAGE... [OPTIONS]

Options:

  • --nodes, -n TEXT - Comma-separated node list (default: all nodes)

Examples:

Terminal window
loko registry load-image myapp:latest
loko registry load-image myapp:latest myapp:v1.0.0

Show environment health status (Phase 4).

Terminal window
loko status [OPTIONS]

Options:

  • --short - Show compact table view instead of detailed panels
  • --workloads - Show detailed per-service breakdown for workloads
  • --format TEXT - Output format: rich, json, text
  • --force-color - Force colored output even when piping

Health Components:

  • Cluster: Kubernetes cluster running state
  • DNS: dnsmasq health and OS resolver configuration
  • Tunnel: HAProxy TCP load balancer for database access
  • Registry: Local OCI registry (if enabled)
  • Workloads: Deployed services health status

Health States:

  • Healthy (green) - Component running normally
  • Degraded (yellow) - Running but issues detected
  • Stopped (gray) - Component stopped
  • Not Configured (dim) - Component not enabled

Examples:

Terminal window
loko status # Default: detailed panel view
loko status --short # Compact table view
loko status --format json # JSON output for scripting
loko status --workloads # Detailed workload breakdown

Validate environment.

Terminal window
loko validate [OPTIONS]

Runs a full environment validation (including self-test app deployment).

Options:

  • --cleanup - Cleanup the self-test app and test namespace after validation (default keeps them for inspection)
  • --format TEXT - Output format: rich, json, text
  • --force-color - Force colored output even when piping

Examples:

Terminal window
loko validate # Runs validation and keeps self-test resources
loko validate --cleanup # Runs validation and then cleans up test resources
loko env validate --cleanup # Same behavior through env alias

Generate shell completion.

Terminal window
loko completion {bash|zsh|fish}

Examples:

Terminal window
loko completion bash > ~/.loko-completion.bash
loko completion zsh > ~/.loko-completion.zsh

Available for all commands:

  • --help - Show help message
  • --version - Show version
  • --config, -c TEXT - Configuration file path override (default: loko.yaml)

If --config is omitted, many runtime commands use the active environment from inventory before falling back to ./loko.yaml.

CodeMeaning
0Success
1General error
2Config error
3Cluster error
4Workload error
5DNS error
6Certificate error
  • LOKO_CONFIG_FILE - Default config file path
  • LOKO_DEBUG - Enable debug output
  • LOKO_NO_COLOR - Disable colored output

Example:

Terminal window
export LOKO_CONFIG_FILE=custom-config.yaml
export LOKO_DEBUG=1
loko status