Skip to content

Commit 85be5bb

Browse files
authored
Merge pull request #29126 from tengqm/add-apiserver-traceconfig
Add API server config API v1alpha1
2 parents 8518607 + 683d285 commit 85be5bb

File tree

3 files changed

+468
-6
lines changed

3 files changed

+468
-6
lines changed

content/en/docs/concepts/cluster-administration/system-traces.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,23 @@ weight: 60
1313

1414
System component traces record the latency of and relationships between operations in the cluster.
1515

16-
Kubernetes components emit traces using the [OpenTelemetry Protocol](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#opentelemetry-protocol-specification) with the gRPC exporter and can be collected and routed to tracing backends using an [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector#-opentelemetry-collector).
16+
Kubernetes components emit traces using the
17+
[OpenTelemetry Protocol](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#opentelemetry-protocol-specification)
18+
with the gRPC exporter and can be collected and routed to tracing backends using an
19+
[OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector#-opentelemetry-collector).
1720

1821
<!-- body -->
1922

2023
## Trace Collection
2124

22-
For a complete guide to collecting traces and using the collector, see [Getting Started with the OpenTelemetry Collector](https://opentelemetry.io/docs/collector/getting-started/). However, there are a few things to note that are specific to Kubernetes components.
25+
For a complete guide to collecting traces and using the collector, see
26+
[Getting Started with the OpenTelemetry Collector](https://opentelemetry.io/docs/collector/getting-started/).
27+
However, there are a few things to note that are specific to Kubernetes components.
2328

24-
By default, Kubernetes components export traces using the grpc exporter for OTLP on the [IANA OpenTelemetry port](https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=opentelemetry), 4317. As an example, if the collector is running as a sidecar to a Kubernetes component, the following receiver configuration will collect spans and log them to standard output:
29+
By default, Kubernetes components export traces using the grpc exporter for OTLP on the
30+
[IANA OpenTelemetry port](https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=opentelemetry), 4317.
31+
As an example, if the collector is running as a sidecar to a Kubernetes component,
32+
the following receiver configuration will collect spans and log them to standard output:
2533

2634
```yaml
2735
receivers:
@@ -43,11 +51,19 @@ service:
4351
4452
### kube-apiserver traces
4553
46-
The kube-apiserver generates spans for incoming HTTP requests, and for outgoing requests to webhooks, etcd, and re-entrant requests. It propagates the [W3C Trace Context](https://www.w3.org/TR/trace-context/) with outgoing requests but does not make use of the trace context attached to incoming requests, as the kube-apiserver is often a public endpoint.
54+
The kube-apiserver generates spans for incoming HTTP requests, and for outgoing requests
55+
to webhooks, etcd, and re-entrant requests. It propagates the
56+
[W3C Trace Context](https://www.w3.org/TR/trace-context/) with outgoing requests
57+
but does not make use of the trace context attached to incoming requests,
58+
as the kube-apiserver is often a public endpoint.
4759
4860
#### Enabling tracing in the kube-apiserver
4961
50-
To enable tracing, enable the `APIServerTracing` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) on the kube-apiserver. Also, provide the kube-apiserver with a tracing configration file with `--tracing-config-file=<path-to-config>`. This is an example config that records spans for 1 in 10000 requests, and uses the default OpenTelemetry endpoint:
62+
To enable tracing, enable the `APIServerTracing`
63+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
64+
on the kube-apiserver. Also, provide the kube-apiserver with a tracing configration file
65+
with `--tracing-config-file=<path-to-config>`. This is an example config that records
66+
spans for 1 in 10000 requests, and uses the default OpenTelemetry endpoint:
5167

5268
```yaml
5369
apiVersion: apiserver.config.k8s.io/v1alpha1
@@ -57,10 +73,17 @@ kind: TracingConfiguration
5773
samplingRatePerMillion: 100
5874
```
5975

76+
For more information about the `TracingConfiguration` struct, see
77+
[API server config API (v1alpha1)](/docs/reference/config-api/apiserver-config.v1alpha1/#apiserver-k8s-io-v1alpha1-TracingConfiguration).
78+
6079
## Stability
6180

62-
Tracing instrumentation is still under active development, and may change in a variety of ways. This includes span names, attached attributes, instrumented endpoints, etc. Until this feature graduates to stable, there are no guarantees of backwards compatibility for tracing instrumentation.
81+
Tracing instrumentation is still under active development, and may change
82+
in a variety of ways. This includes span names, attached attributes,
83+
instrumented endpoints, etc. Until this feature graduates to stable,
84+
there are no guarantees of backwards compatibility for tracing instrumentation.
6385

6486
## {{% heading "whatsnext" %}}
6587

6688
* Read about [Getting Started with the OpenTelemetry Collector](https://opentelemetry.io/docs/collector/getting-started/)
89+

content/en/docs/reference/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ configure kubernetes components or tools. Most of these APIs are not exposed
7171
by the API server in a RESTful way though they are essential for a user or an
7272
operator to use or manage a cluster.
7373

74+
* [kube-apiserver configuration (v1alpha1)](/docs/reference/config-api/apiserver-config.v1alpha1/)
7475
* [kubelet configuration (v1beta1)](/docs/reference/config-api/kubelet-config.v1beta1/)
7576
* [kube-scheduler configuration (v1beta1)](/docs/reference/config-api/kube-scheduler-config.v1beta1/)
7677
* [kube-scheduler configuration (v1beta2)](/docs/reference/config-api/kube-scheduler-config.v1beta2/)

0 commit comments

Comments
 (0)