CLI Reference

Overview

The kl CLI is a command-line tool for managing Kloudlite workspaces from within your Dev Container. It provides commands to manage workspace configuration, packages, environment connections, and service interception.

Example: Common Commands

# Show workspace status

kl status

# Add packages

kl pkg add git vim curl

# Connect to environment

kl env connect my-env

# Intercept a service

kl intercept start api-server

Interactive Mode

Many commands support interactive mode using fuzzy-find (fzf) when run without arguments, making it easy to select packages, environments, or services.

Workspace Commands

kl status (aliases: st, s)

Display comprehensive workspace information including metadata, resource usage, access URLs, and timing information.

kl status

Displays:

  • Workspace name, namespace, and owner
  • Phase and status message
  • Resource usage (CPU, Memory, Storage)
  • Access URLs for services
  • Runtime and activity timestamps

kl version (aliases: v)

Show version information for the kl CLI tool.

kl version

Package Management

Manage Nix packages in your workspace using the kl pkg command (aliases: package, p).

kl pkg search (aliases: find, s)

Search for available Nix packages using the Devbox package registry.

kl pkg search nodejs
kl p s python

kl pkg add (aliases: a)

Add packages to your workspace. When run without arguments, enters interactive mode with fuzzy search and version selection. When run with package names, automatically installs the latest version.

kl pkg add              # Interactive mode
kl pkg add git vim curl # Add multiple packages
kl p a nodejs python    # Using aliases

Timeout: Package installation waits up to 5 minutes for completion.

kl pkg install (aliases: i, in)

Install a specific Nix package with optional version, channel, or commit specification.

Flags:

  • --version - Semantic version (e.g., 24.0.0)
  • --channel - Nixpkgs channel (e.g., nixos-24.05)
  • --commit - Exact nixpkgs commit hash
kl pkg install nodejs
kl pkg install nodejs --version 20.0.0
kl pkg install vim --channel nixos-24.05
kl p i git --channel unstable

kl pkg uninstall (aliases: remove, rm, un)

Remove a package from your workspace.

kl pkg uninstall git
kl p rm vim

kl pkg list (aliases: ls, l)

Display all packages in the workspace spec and their installation status.

kl pkg list
kl p ls

Output includes:

  • Workspace spec packages with channel/commit info
  • Installed packages with version and binary path
  • Failed packages (if any)

Environment Connection

Manage workspace environment connections using the kl env command (aliases: e, environment). When connected to an environment, services can be accessed using short DNS names.

kl env connect (aliases: c, conn)

Connect workspace to an environment for simplified service access. If no environment name is provided, an interactive list will be shown.

kl env connect           # Interactive selection
kl env connect my-env    # Connect to specific env
kl e c my-env            # Using aliases

After Connecting

Access services using short names like postgres:5432 instead of full qualified names.

kl env disconnect (aliases: d, disc)

Disconnect workspace from the connected environment. This removes all active intercepts for that environment.

kl env disconnect
kl e d

kl env status (aliases: st, stat)

Show the current environment connection status and available services.

kl env status
kl e st

Displays:

  • Connection status and environment name
  • Target namespace
  • Service access examples
  • Active service intercepts

Service Interception

Manage service interception using the kl intercept command (aliases: i, int). Service interception redirects traffic from a service to your workspace.

Prerequisite

You must connect to an environment using kl env connect before you can intercept services.

kl intercept start (aliases: s, begin)

Start intercepting a service to redirect its traffic to your workspace. If no service name is provided, an interactive list will be shown with port mapping options.

kl intercept start            # Interactive selection
kl intercept start api-server # Intercept specific service
kl i s api-server             # Using aliases

kl intercept stop (aliases: sp, end)

Stop intercepting a service and restore normal traffic routing. If no service name is provided, an interactive list of active intercepts will be shown.

kl intercept stop            # Interactive selection
kl intercept stop api-server # Stop specific intercept
kl i sp api-server           # Using aliases

kl intercept list (aliases: ls)

List all active service intercepts in the connected environment.

kl intercept list
kl i ls

Output includes:

  • Service name and phase (Pending, Active, Failed)
  • Port mappings (service → workspace)
  • Error messages (if failed)

kl intercept status (aliases: st)

Show detailed status of service intercept(s). Can show all intercepts or a specific service intercept.

kl intercept status            # Show all intercepts
kl intercept status api-server # Show specific service
kl i st api-server             # Using aliases

Displays:

  • Service and workspace details
  • Phase and status messages
  • Port mappings
  • Workspace pod details (name, IP)
  • Affected pods and start time