Commands
Auto-generated documentation of keptn CLI
Home / Docs / Release 0.6.2 / Reference / 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.
This works for Linux and Mac only.
This will download the 0.6.2 CLI version from GitHub, unpack it and move it to /usr/local/bin/keptn
.
curl -sL https://get.keptn.sh | sudo -E bash
Verify that the installation has worked and that the version is correct by running:
keptn version
Every release of Keptn provides binaries for the keptn CLI. These binaries are available for Linux, macOS, and Windows.
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.
Verify that the installation has worked and that the version is correct by running:
keptn version
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).
To fully use the keptn CLI, it needs to be authenticated against a Kubernetes cluster with Keptn already installed on it. Therefore, an endpoint and an API token are required.
If the authentication is successful, keptn CLI will inform the user. The specified endpoint as well as the API token are
stored in a password store of the underlying operating system. More precisely, the keptn CLI stores the endpoint and
API token using pass
in case of Linux, using Keychain
in case of macOS, or Wincred
in case of Windows.
Set the needed environment variables. Authenticate to the Keptn cluster. Note: If you receive a warning For Linux / macOS
KEPTN_ENDPOINT=https://api.keptn.$(kubectl get cm keptn-domain -n keptn -ojsonpath={.data.app_domain})
KEPTN_API_TOKEN=$(kubectl get secret keptn-api-token -n keptn -ojsonpath={.data.keptn-api-token} | base64 --decode)
keptn auth --endpoint=$KEPTN_ENDPOINT --api-token=$KEPTN_API_TOKEN
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.
Please expand the corresponding section matching your CLI tool. For the Windows PowerShell, a small script is provided that installs the Copy the following snippet and paste it in the PowerShell. The snippet will be automatically executed line by line. Now that everything we need is stored in environment variables, we can proceed with authorizing the keptn CLI. To authenticate against the Keptn cluster, use the In the Windows Command Line, a couple of steps are necessary. Get the Keptn API Token encoded in base64 Take the encoded API token - it is the value from the key Decode the file Open the newly created file Get the Keptn cluster endpoint Copy the Now that everything we need is stored in environment variables, we can proceed with authorizing the keptn CLI. To authenticate against the Keptn cluster, use the For Windows
PowerShell
PSYaml
module and sets the environment variables. Please note that the PowerShell might have to be started with Run as Administrator privileges to install the module.
$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))
$Env:KEPTN_ENDPOINT = 'https://api.keptn.'+$(kubectl get cm -n keptn keptn-domain -ojsonpath='{.data.app_domain}')
auth
command with the Keptn endpoint and API token:keptn.exe auth --endpoint=$Env:KEPTN_ENDPOINT --api-token=$Env:KEPTN_API_TOKEN
Command Line
kubectl get secret keptn-api-token -n keptn -ojsonpath={.data.keptn-api-token}
abcdefghijkladfaea
keptn-api-token
(in this example, it is abcdefghijkladfaea
) and save it in a text file, e.g., keptn-api-token-base64.txt
certutil -decode keptn-api-token-base64.txt keptn-api-token.txt
keptn-api-token.txt
, copy the value and paste it into the next commandset KEPTN_API_TOKEN=keptn-api-token
kubectl get cm -n keptn keptn-domain -ojsonpath={.data.app_domain}
YOUR.DOMAIN
domain
value and save it in an environment variableset KEPTN_ENDPOINT=https://api.keptn.YOUR.DOMAIN
auth
command with the Keptn endpoint and API token:keptn.exe auth --endpoint=KEPTN_ENDPOINT --api-token=KEPTN_API_TOKEN