Skip to content

kloudlite/kl

Kloudlite CLI kl

kl is command line interface for developers to work with environments in kloudlite. This will help developers to create local development containers which are connected to remote environments.

Installation

To install the latest version in Linux or Mac you can run the following command on terminal.

Installation of kl

Install latest with curl
curl 'https://kl.kloudlite.io/kloudlite/kl!?select=kl' | bash
Install latest with wget
wget -qO- 'https://kl.kloudlite.io/kloudlite/kl!?select=kl' | bash
Install specific version
curl 'https://kl.kloudlite.io/kloudlite/[email protected]!?select=kl' | bash
download but don't install
curl 'https://kl.kloudlite.io/kloudlite/kl?select=kl' | bash
install in windows
iwr 'https://kl.kloudlite.io/kloudlite/kl!?select=kl' | iex

Authentication

To login and logout you can use the following commands.

kl auth login
kl auth logout
kl auth status

Initialize your workspace

To work with any project you need to initialize your workspace where you can define environments, managed resouces, mounts and etc. To initialize you workspace you can use the following command.

kl init

Configure Envvars & Config Mounts

To configure environment variables & configs mounts you can use following commands

kl add config
kl add secret
kl add config-mount <file_path>

These commands will prompt to select configs and secrets from the list of available resources in the environment.

Manage Nix Packages

You will be able to manage nix packages that are available in the container using the following commands.

kl pkg add <package-name>

You can search and add packages form NixHub

Switch between Environments

You can switch between remote environments using the following command.

kl env use

This command will prompt to select environment from the list of available environments.

SSH into container

Container will be running a ssh server. You will be able to check the configuration with kl box info command inside your workspace

You can ssh into the container using the following command.

kl box ssh

This command will start the container if it is not running and ssh into the container.

Expose Ports

You can expose ports from the container to your local machine using the following command.

kl box expose -p <container-port>

Intercept applications

You can intercept applications running in remote environments to your local machine using the following commands.

kl intercept start -p <remote-port>:<local-port>

This command will prompt to choose the application from the list of available applications in the environment.

KL Config File structure

This is the structure of kloudlite config file which will be generated by executing the command kl init and you can also modify this file according to your requirement.

version: v1
accountName: <kloudlite-account-name>
defaultEnv: <default-environment>
packages:
# list of nix packages
- [email protected]
# ...
ports:
# list of exposed ports
- 8080
# ...
envVars:
# list of environment variables
envVars:
- key: ENV_VAR_NAME
  secretRef: <secret-name>/<secret-key>
- key: ENV_VAR_NAME2
  configRef: <config-name>/<config-key>
- key: ENV_VAR_NAME3
  configRef: <mres-name>/<mres-key>
- key: ENV_VAR_NAME4
  value: TEST_VALUE
# ...
mounts:
- path: <mount-path>
  configRef: <config-name>/<config-key>
- path: <mount-path>
  secretRef: <secret-name>/<secret-key>