In this tutorial we are going to learn how to install Keptn in your Kubernetes cluster running as K3s.

Please download and install the following tools if you do not have them installed on your machine already.

We are going to setup a Kubernetes cluster with K3s. Please note that K3s is natively available for Linux, therefore the following commands are for Linux hosts.

  1. Download, install K3s (tested with versions 1.16 to 1.18) and run K3s using the following command
    curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.18.3+k3s1 K3S_KUBECONFIG_MODE="644" sh -s - --no-deploy=traefik
    
    This installs version v1.18.3+k3s1 (please refer to the K3s GitHub releases page for newer releases), sets file permissions 644 on /etc/rancher/k3s/k3s.yaml and disables traefik as an ingress controller.
  2. Export the Kubernetes profile using
    export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
    
  3. Verify that the connection to the cluster works:
    kubectl get nodes   
    

Find a full compatibility matrix for supported Kubernetes versions here.

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:

To install the latest release of Keptn with full quality gate + continuous delivery capabilities in your Kubernetes cluster, execute the keptn install command.

keptn install --endpoint-service-type=ClusterIP --use-case=continuous-delivery

Installation details

In the Keptn namespace, the following deployments should be found:

kubectl get deployments -n keptn

NAME                                             READY   UP-TO-DATE   AVAILABLE   AGE
api-gateway-nginx                                1/1     1            1           2m44s
api-service                                      1/1     1            1           2m44s
bridge                                           1/1     1            1           2m44s
configuration-service                            1/1     1            1           2m44s
eventbroker-go                                   1/1     1            1           2m44s
gatekeeper-service                               1/1     1            1           2m44s
helm-service                                     1/1     1            1           2m44s
helm-service-continuous-deployment-distributor   1/1     1            1           2m44s
jmeter-service                                   1/1     1            1           2m44s
lighthouse-service                               1/1     1            1           2m44s
mongodb                                          1/1     1            1           2m44s
mongodb-datastore                                1/1     1            1           2m44s
remediation-service                              1/1     1            1           2m44s
shipyard-service                                 1/1     1            1           2m44s

Expose the Keptn endpoint via the following command to be able to access on localhost. Please note that the port-forward must be kept open for the next commands to succeed, therefore we recommend doing this in a separate terminal.

kubectl -n keptn port-forward service/api-gateway-nginx 8080:80

Set the following variables to make it easy to connect to Keptn.

KEPTN_ENDPOINT=http://localhost:8080/api
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
Starting to authenticate
Successfully authenticated

Now that you have installed Keptn you can take a look at its user interace aka the Keptn's Bridge.

Keptn's Bridge

Open a browser and navigate to http://localhost:8080 to take look. The bridge will be empty at this point but when using Keptn it will be populated with events.

If asked for credentials, you can get them by executing the following command.

keptn configure bridge --output

empty bridge

Keptn API

Besides the Keptn's Bridge, please consider also taking a look at the Keptn API endpoint if you are interested to interact with Keptn via the API. Keptn comes with a fully documented swagger-API that can be found under the /api endpoint.

api

Now that you have successfully installed Keptn, you can explore other tutorials!

Here are some possibilities: