Guides
Tracking tenants
Kinference policies can take into account the tenant (aka client) that issued the request. It can also optionally track metrics on a per-tenant basis.
Setting the tenant identification header #
Kinference determines the tenant id simply by reading it from a header. To enable this behavior, you must configure the header to use.
To configure the header that determines Kinference’s client id, set the
extension.tenantHeader configuration in the Kinference Helm chart. For
example, to set it to l5d-client-id, run this command:
TENANT_HEADER=l5d-client-id # Linkerd client identity
helm upgrade -i kinference oci://cr.kinference.ai/kinference-ai/charts/kinference --devel --reuse-values --set extension.tenantHeader=$TENANT_HEADER --waitYou can now apply policies to specific tenants or groups thereof.
If this configuration is not supplied, or if it is supplied, but the header for a request is unset, the tenant value "" will be used. You may write policies that use this header value directly.
Disabling per-tenant metrics #
By default, Kinference tracks metrics for all tenants and creates timeseries for each.
If you expect to have an unbounded number of tenants, there are two alternatives:
- Use an allowlist
- Disable per-tenant metrics tracking alltogether.
In either case, tenants for whom metrics are not tracked (as well as tenants for
whom no value is provided in the corresponding header) are bucketed into the
default tenant for metrics purposes.
To use the allowlist approach, set the config.metrics.tenant_labels value in
the Kinference Helm chart to a list of tenant ids. For example, to only track
metrics for the tenants alice and bob, run this command:
helm upgrade kinference oci://cr.kinference.ai/kinference-ai/charts/kinference --devel --reuse-values --set "config.metrics.tenant_labels={alice,bob}" --waitTo disable per-tenant metrics tracking altogether, set it to none instead:
helm upgrade kinference oci://cr.kinference.ai/kinference-ai/charts/kinference --devel --reuse-values --set config.metrics.tenant_labels=none --waitThe Kinference pods will restart, and metrics collection going forward will use the tenant tracking you configured.