Add docs for hostname metrics in egress traffic (#1946)

Signed-off-by: Scott Fleener <scott@buoyant.io>
This commit is contained in:
Scott Fleener 2025-04-07 14:21:56 -04:00 committed by GitHub
parent aa592d6a59
commit 429b2acb63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 45 additions and 0 deletions

View File

@ -51,6 +51,7 @@ metadata:
namespace: egress-test
annotations:
linkerd.io/inject: enabled
config.linkerd.io/proxy-metrics-hostname-labels: true
spec:
containers:
- name: client
@ -92,6 +93,14 @@ outbound_http_route_request_statuses_total{
} 697
```
{{< note >}}
Outbound metrics do not include the hostname by default. See
[Hostnames in metrics](#hostnames-in-metrics) for details and how to include
them like in the example above.
{{< /note >}}
Notice that these raw metrics allow you to quickly identify egress traffic targeted
towards different destinations simply by querying for `parent_kind` of type
`EgressNetwork`. For now all traffic is allowed and we are simply observing it.
@ -100,6 +109,42 @@ set to `Allow`, the default http route is named as `http-egress-allow`.
This is a placeholder route that is being populated automatically by the
Linkerd controller.
### Hostnames in metrics
By default, outbound metrics do not include the hostname in the `hostname`
label, both for cluster-local and egress traffic. This is a safe default for
workloads that address a large number of discrete destination hostnames to
prevent high cardinality in outbound metrics.
If this isn't a concern for your workloads, the hostname metrics can be enabled
on a per-workload or per-namespace basis by setting the
`config.linkerd.io/proxy-metrics-hostname-labels` annotation to `true` on a
single pod or namespace, respectively.
Hostname metrics can also be enabled cluster-wide through the values in
`linkerd install`:
```bash
# With a single value
linkerd install --set proxy.metrics.hostnameLabels=true | kubectl apply -f -
# Or ith a values.yaml file
#
# <values.yaml>
proxy:
metrics:
hostnameLabels: true
linkerd install --values=values.yaml | kubectl apply -f -
```
{{< note >}}
The rest of the examples on this page assume that the hostname metrics have been
enabled, for clarity.
{{< /note >}}
## Restricting egress traffic
After you have used metrics in order to compose a picture of your egress