In this tutorial we are going to learn how to install keptn on k3s.

What you'll learn

Why would you want to do this?

What is K3s?

Disclaimer

But:

To start the keptn-on-k3s installation properly, you need a machine running Linux with the curl package installed.

Currently, this has been tested using following distributions:

Hardware Requirements:

Cloud Providers "supported" (Mechanism for detecting the external IP is available)

If you want to install keptn-on-k3s with Dynatrace support, you will need to create a Dynatrace token.

  1. Create a Dynatrace API TokenLog in to your Dynatrace tenant and go to Settings > Integration > Dynatrace API. Then, create a new API token with the following permissions:
    • Access problem and event feed, metrics and topology
    • Access logs
    • Read configuration
    • Write configuration
    • Capture request data
    Take a look at this screenshot to double check the right token permissions for you.Dynatrace API Token
  2. Set the DT_API_TOKEN and DT_TENANT environment variables
    export DT_TENANT=yourtenant.live.dynatrace.com
    export DT_API_TOKEN=yourAPItoken
    

Keptn-on-k3s is a keptn-sandbox project at the moment. It is a very simple shell script, which installs k3s (from their GitHub Repository) and afterwards applies the manifests for keptn.

The keptn-dynatrace-service or the keptn-prometheus-service can also be installed automatically with keptn-on-k3s. This can be achieved by specifying a provider (this will query the corresponding metadata endpoint) or set the IP address manually. If hostname -I is working on the machine and no provider or IP address is specified, the installer will use the first reasonable IP address.

To expose keptn's bridge and the api via an ingress controller, keptn-on-k3s needs to know the IP address which will be used (to generate a xip.io entry and the Ingress objects).

You can install keptn-on-k3s (with autodetection of your IP address using the command hostname -I):

curl -Lsf https://raw.githubusercontent.com/keptn-sandbox/keptn-on-k3s/master/install-keptn-on-k3s.sh | bash -s - 

(Optional): Specifying the source of the IP address

When installing keptn-on-k3s on a public cloud, the IP address can not be detected directly on the host. Therefore, a --provider option is implemented, which instructs the script to query the metadata endpoint of the the specified cloud provider and get the public ip address of the node.

As a result, the installation- of keptn-on-k3s on a cloud provider can be triggered using the command:

curl -Lsf https://raw.githubusercontent.com/keptn-sandbox/keptn-on-k3s/master/install-keptn-on-k3s.sh | bash -s - --provider [gke|aks|digitalocean]

It may be the case, that you want to specify the IP address manually, this can be achieved using the --ip option:

curl -Lsf https://raw.githubusercontent.com/keptn-sandbox/keptn-on-k3s/master/install-keptn-on-k3s.sh | bash -s - --ip [your-ip]

(Optional): Installing Add-Ons

Additionally, you can install keptn-on-k3s with support for Dynatrace, Prometheus or the jMeter service. This can be done via the --with-dynatrace, --with-prometheus or --with-jmeter flags.

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

There are multiple options how to get the Keptn CLI on your machine.

Now, you should be able to run the Keptn CLI:

After installation, you get the required information needed to communicate with the keptn API or to access the keptn's Bridge. Therefore, the following output is shown at the end of the installation (In this example, -ip 127.0.0.1 has been used for the installation):

API URL   :      https://api.keptn.127.0.0.1.xip.io
Bridge URL:      https://bridge.keptn.127.0.0.1.xip.io
Bridge Username: keptn
Bridge Password: FvSv8KLD1sCa7LWrW1yEV7TUAy6g5T35
API Token :      qonZAH53/L/LbN7Rph9Mkg==
To use keptn:
- Install the keptn CLI: curl -sL https://get.keptn.sh | sudo -E bash
- Authenticate: keptn auth  --api-token "qonZAH53/L/LbN7Rph9Mkg==" --endpoint "https://api.keptn.127.0.0.1.xip.io"

Connecting the keptn CLI to the API

Using this information, you can simply connect the keptn CLI to the API

keptn auth --endpoint=API-URL --api-token=API-Token

At the end a message indicating that you are successfully authenticated should be shown.

Accessing the Bridge

The keptn's bridge is exposed automatically, and can be accessed using the URL and the credentials which are displayed after the installation.

Now that you have successfully installed the keptn control plane, you may want to configure quality gates.

Here are some possibilities: