Keptn API

In this section, the functionality and commands of the Keptn REST API are described.

Prerequisites

  • To access the Keptn API, a running Keptn installation is needed. If you have not set up Keptn yet, please start here.

Access the Keptn API

The Keptn API is documented in terms of a Swagger API documentation. Use the Keptn CLI to retrieve the endpoint of your Keptn API via the command keptn status.

keptn status

Output:

Starting to authenticate
Successfully authenticated
CLI is authenticated against the Keptn cluster https://api.keptn.XX.XXX.XX.XXX.io

Access the Keptn Swagger API documentation in your browser at https://api.keptn.XX.XXX.XX.XXX.io/swagger-ui/. You should see something similar to the screenshot:

Keptn Swagger API documentation

Explore the API

Clicking on an endpoint reveals more details how to use it, including definitions and examples of the payload.

Keptn Swagger API documentation - Example

Technical Details of the Cluster Gateway

The following descriptions are only valid for a full Keptn installation (i.e., a Keptn installation which was not installed for the quality-gates use case).

Keptn uses Istio for connecting and controlling the traffic. In order to receive incoming and outgoing connections, a Gateway named public-gateway is available in the istio-system namespace.

Details of the Gateway

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: public-gateway
namespace: istio-system
spec:
selector:
    istio: ingressgateway
servers:
- port:
    name: http
    number: 80
    protocol: HTTP
    hosts:
    - '*'    
- hosts:
    - '*'
    port:
    name: https
    number: 443
    protocol: HTTPS
    tls:
    mode: SIMPLE
    privateKey: /etc/istio/ingressgateway-certs/tls.key
    serverCertificate: /etc/istio/ingressgateway-certs/tls.crt

This Gateway accepts HTTP and HTTPS traffic. For the HTTPS traffic, Keptn generates a self-signed certificate during the installation.

If you already have a valid certificate for your domain and want to use this, please first configure your domain and, afterwards, manually update the used certificate in the Gateway. For adding a custom certificate, the Knative Documentation provides useful instructions.