This documentation is under develop and not officially released.

Keptn CLI

Explains how to download and install the Keptn CLI as well as which commands are available.


Auto-generated documentation of keptn CLI

In this section, the functionality and commands of the Keptn CLI are described. The Keptn CLI allows installing, configuring, and uninstalling Keptn. Furthermore, the CLI allows creating projects, onboarding services, and sending new artifact events.


  • All prerequisites from the setup are needed.

Automatic install of Keptn CLI

This works for Linux and Mac only.

  1. This will download the 0.7.3 CLI version from GitHub, unpack it and move it to /usr/local/bin/keptn.

    curl -sL | sudo -E bash
  2. Verify that the installation has worked and that the version is correct by running:

    keptn version

Download and manual install of Keptn CLI

Every release of Keptn provides binaries for the Keptn CLI. These binaries are available for Linux, macOS, and Windows.

  1. Download the version matching your operating system
  2. Unpack the download
  3. Find the keptn binary in the unpacked directory.

    • Linux / macOS: Add executable permissions (chmod +x keptn), and move it to the desired destination (e.g. mv keptn /usr/local/bin/keptn)

    • Windows: move/copy the executable to the desired folder and, optionally, add the executable to the PATH environment variable for a more convenient experience.

  4. Verify that the installation has worked and that the version is correct by running:

    keptn version

Start using Keptn CLI

In the following, the commands provided by the Keptn CLI are described. To list all available commands just execute:

keptn --help

All of these commands also support the help flag (--help), which describes details of the respective command (e.g., usage of the command or description of flags).

Authenticate Keptn CLI

To authenticate the Keptn CLI against the Keptn cluster, the exposed Keptn endpoint and API token are required.

  • Get the Keptn endpoint from the api-gateway-nginx. (If you are using port-forward to expose Keptn, your endpoint is localhost and the port you forwarded Keptn to, e.g.: http://localhost:8080)
kubectl -n keptn get service api-gateway-nginx
NAME                TYPE        CLUSTER-IP    EXTERNAL-IP                  PORT(S)   AGE
api-gateway-nginx   ClusterIP   <ENDPOINT_OF_API_GATEWAY>    80/TCP    44m

Retrive API Token and Authenticate Keptn CLI on Linux / MacOS

  • Set the environment variable KEPTN_ENDPOINT:
  • Set the environment variable KEPTN_API_TOKEN:
KEPTN_API_TOKEN=$(kubectl get secret keptn-api-token -n keptn -ojsonpath={.data.keptn-api-token} | base64 --decode)
  • To authenticate the CLI against the Keptn cluster, use the keptn auth command:
keptn auth --endpoint=$KEPTN_ENDPOINT --api-token=$KEPTN_API_TOKEN

Note: If you receive a warning Using a file-based storage for the key because the password-store seems to be not set up. this is because a password store could not be found in your environment. In this case, the credentials are stored in ~/.keptn/.password-store in your home directory.

Retrive API Token and Authenticate Keptn CLI on Windows

Please expand the corresponding section matching your CLI tool:


For the Windows PowerShell, a small script is provided that installs the PSYaml module and sets the environment variables.

  • Set the environment variable KEPTN_ENDPOINT:
  • Copy the following snippet and paste it in the PowerShell. The snippet retrieves the API token and sets the environment variable KEPTN_API_TOKEN:
$tokenEncoded = $(kubectl get secret keptn-api-token -n keptn -ojsonpath='{.data.keptn-api-token}')
$Env:KEPTN_API_TOKEN = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($tokenEncoded))
  • To authenticate the CLI against the Keptn cluster, use the keptn auth command:
keptn auth --endpoint=$Env:KEPTN_ENDPOINT --api-token=$Env:KEPTN_API_TOKEN

Command Line

In the Windows Command Line, a couple of steps are necessary.

  • Set the environment variable KEPTN_ENDPOINT:
  • Get the Keptn API Token encoded in base64:
kubectl get secret keptn-api-token -n keptn -ojsonpath={.data.keptn-api-token}
  • Take the encoded API token - it is the value from the key keptn-api-token (in this example, it is abcdefghijkladfaea) and save it in a text file, e.g., keptn-api-token-base64.txt

  • Decode the file:

certutil -decode keptn-api-token-base64.txt keptn-api-token.txt
  • Open the newly created file keptn-api-token.txt, copy the value and paste it into the next command:
set KEPTN_API_TOKEN=keptn-api-token
  • To authenticate the CLI against the Keptn cluster, use the keptn auth command:
keptn.exe auth --endpoint=%KEPTN_ENDPOINT% --api-token=%KEPTN_API_TOKEN%

Use Keptn CLI with multiple contexts

After authenticating the Keptn CLI with multiple Kubernetes clusters, we can directly run Keptn CLI commands in the current context.

  • As soon as you switch the Kube context (e.g., by executing: kubectl config use-context my-cluster-name), the Keptn CLI will detect the change of the Kube context and ask you to run the command in the changed context or not.

  • If the Keptn CLI is authenticated for that particular context, the command will run successfully; else it will end up throwing the error: This command requires to be authenticated. See "keptn auth" for details"

  • In case of multi-installation of Keptn in the same cluster, we need to pass the flag --namespace or -n to tell the Keptn CLI to use the credentials for that particular Keptn installation, else it will take the default namespace which is: keptn


The KEPTNCONFIG environment variable holds a config file that contains the credentials (i.e. API_TOKEN and ENDPOINT) for the Keptn installation.

  • The KEPTNCONFIG file format:
  - api_token: abcdxxxxxxxx1234
    endpoint: https://localhost:8080/api
    name: keptn-test                  # context name                    
    namespace: keptn-test             # namespace name, the default is `keptn` if not set
  - api_token: abcdxxxxxxxx1234
    name: keptn-demo        
  • If KEPTNCONFIG environment variable is defined, the Keptn CLI reads the credentials from it.

  • If the credentials are not found in the config file, it will fall back to the credential manager.