Skip to content
Client-Server Access

Client-Server Access

To access the in-cluster service from outside the cluster, you need a Route or Ingress. Create the supplied OpenShift Route and get its external URL:

oc apply -k github.com/korrel8r/korrel8r/config/route?version=main
export KORREL8R_URL=$(oc get route/korrel8r -n openshift-cluster-observability-operator -o template='https://{{.spec.host}}')

Alternatively, create an equivalent re-encrypt Route directly:

oc create route reencrypt --service=korrel8r -n openshift-cluster-observability-operator
export KORREL8R_URL=$(oc get route/korrel8r -n openshift-cluster-observability-operator -o template='https://{{.spec.host}}')

You can access the server in two ways:

  • korrel8rcli — purpose-built command-line client for Korrel8r
  • Direct HTTP requests — use curl or similar tools against the REST API

Command-Line Client

korrel8rcli is a command line client to call on a remote korrel8r server.

Installation:

go install github.com/korrel8r/client/cmd/korrel8rcli@latest

korrel8rcli automatically uses your cluster login credentials.

Replace $KORREL8R_URL with the URL of your korrel8r service in these examples.

# Check what data sources are available
korrel8rcli -u $KORREL8R_URL domains

# Find everything related to a deployment
korrel8rcli -u "$KORREL8R_URL" neighbors --query 'k8s:Deployment:{namespace: korrel8r, name: korrel8r}'

# Find all logs related to a deployment
korrel8rcli -u "$KORREL8R_URL" goals --start 'k8s:Deployment:{namespace: korrel8r, name: korrel8r}' --goal 'log:application'

See the documentation or run korrel8rcli --help for more details.

Direct REST API Access

You can use curl or any HTTP client to interact with the Korrel8r REST API directly. You need to pass a bearer token to the service, $(oc whoami -t) returns your token.

# Get available domains
curl --oauth2-bearer "$(oc whoami -t)" \
  "$KORREL8R_URL/api/v1alpha1/domains"

# Perform a neighborhood search; --data-urlencode safely encodes the query
curl --request POST --get --oauth2-bearer "$(oc whoami -t)" \
  --data-urlencode 'depth=2' \
  --data-urlencode 'query=k8s:Pod:{namespace: default}' \
  "$KORREL8R_URL/api/v1alpha1/graphs/neighbors"

See the complete REST API Reference for all available endpoints.

Troubleshooting

Tip

You can increase the verbosity of korrel8r logging at run time using the config API.

Using korrel8rcli:

korrel8rcli config --set-verbose=9

Using curl:

curl --oauth2-bearer "$(oc whoami -t)" -X PUT \
  "$KORREL8R_URL/api/v1alpha1/config?verbose=9"