The Loft API server provides multiple endpoints to communicate with. Depending on the endpoint, Loft will proxy the request either to its internal Kubernetes API server, to a connected Kubernetes cluster, to a virtual Kubernetes cluster or handle it internally.
The different endpoints can be reached by providing a prefix in front of the actual Kubernetes path (e.g.
https://my-loft-domain.com/$PREFIX/$KUBERNETES_PATH). Based on this prefix, Loft will know how to route the request to the correct destination.
Loft API Server Endpoints
There are several Kubernetes path prefixes for Loft that will target different Kubernetes API servers:
- /kubernetes/management/: Prefix that proxies the request to the internal Loft management Kubernetes API server.
- /kubernetes/cluster/$CLUSTER/: Prefix that proxies incoming Kubernetes requests to the connected cluster $CLUSTER.
- /kubernetes/virtualcluster/$CLUSTER/$NAMESPACE/$VCLUSTER/: Prefix that proxies incoming Kubernetes requests to the virtual cluster $VCLUSTER in namespace $NAMESPACE in the connected cluster $CLUSTER.
For example, if you would want to retrieve pods from a connected cluster
loft-cluster, the corresponding Kubernetes URL would be
With that knowledge, you can also create a kube config to use
kubectl to query that cluster directly through Loft (basically what
loft use cluster is doing internally):
Other non kubernetes endpoints exposed by Loft:
- /auth/: Authentication endpoints that are used by the Loft UI to login a user
- /oidc/: Endpoint for the internal OIDC server. See loft as OIDC provider for more details.
- /grafana/$CLUSTER/: All requests to this endpoint will be proxied to the cluster's grafana instance (if there is any). Used by the Loft UI to show grafana dashboards in the monitoring tab.
Accessing the Loft management API directly
The Loft management API is a Kubernetes API server that only serves virtual resources (not persisted in etcd) that facilitate interaction with Loft. These resources are primarily used by the Loft UI and CLI to change state in the Kubernetes cluster where Loft is installed in, without the need to have cluster wide access.
In order to access the Loft management api, you'll need a Loft access key. See access keys for more information how to create a new access key.
With the access key, you can then query the Loft management API like any other kubernetes API server by prefixing
The Loft management API does only support resources in the API group
management.loft.sh and you won't be able to query any pods, namespaces or other kubernetes resources from it.
To view what resources are available in the management API Kubernetes server, take a look at the loft API repository.
Accessing a connected cluster through Loft directly
Loft acts as a reverse proxy for requests that target a specific connected cluster, with the following differences to directly accessing the kubernetes cluster without Loft:
- Loft will authenticate the request by the provided access key and resolve it into subject and groups that will be forwarded to the kubernetes cluster. The subject and groups are then used by the targeted kubernetes cluster and kiosk to determine cluster and account access through RBAC.
- If the request targets a namespace, the request will count as activity for sleep mode.
- If auditing is enabled, Loft will log the request.
- Loft will also collect certain metrics about the request that can be scraped later with Prometheus.
In order to access a connected cluster through Loft, you'll need a Loft access key. See access keys for more information how to create a new access key.
With the access key
$ACCESS_KEY and the cluster name
$CLUSTER, you can then query the kubernetes API of the connected cluster like any other kubernetes API server by prefixing
Accessing a virtual cluster through Loft directly
Loft is able to proxy virtual cluster requests similar to proxying connected cluster requests.
In order to access a virtual cluster through Loft directly, you need access to the virtual cluster credentials. The easiest way to get these credentials is through the loft CLI:
Directly usable kube config
If you need a directly usable kubeconfig, you can also use:
With the virtual cluster credentials
$CREDENTIALS you can query a virtual cluster
$VCLUSTER in the connected cluster
$CLUSTER in the namespace / space
$NAMESPACE by prefixing