Skip to content

Commit c682528

Browse files
Document Kubernetes objects receiver (k8sobjectsreceiver) (#10696) (#11020)
* Document k8sobjects receiver * Apply comments * Apply comments (cherry picked from commit a3f3f0a) Co-authored-by: Aleksandra Spilkowska <[email protected]>
1 parent ec9f90a commit c682528

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
navigation_title: Kubernetes objects receiver
3+
description: The Kubernetes objects receiver is an OpenTelemetry Collector component that collects Kubernetes API objects and events for Elastic Observability through the EDOT Collector.
4+
applies_to:
5+
stack:
6+
serverless:
7+
observability:
8+
product:
9+
edot_collector:
10+
products:
11+
- id: cloud-serverless
12+
- id: observability
13+
- id: edot-collector
14+
---
15+
16+
# Kubernetes objects receiver
17+
18+
The Kubernetes objects receiver (`k8sobjects`) is a core component of the {{edot}} (EDOT) Collector. It collects Kubernetes API objects, such as events, pods, and namespaces, and emits them as log signals for Elastic Observability.
19+
20+
For full contrib details, refer to the [OpenTelemetry `k8sobjects` receiver documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/k8sobjectsreceiver).
21+
22+
23+
## How it works
24+
25+
The receiver connects to the Kubernetes API server and collects Kubernetes resources as logs. The receiver supports two collection modes:
26+
27+
* `pull`: Periodically lists Kubernetes objects at fixed intervals.
28+
* `watch`: Streams real-time updates from the API server as objects are created, modified, or deleted.
29+
30+
Typical use cases include:
31+
32+
* Collecting Kubernetes objects such as pods, deployments, or configmaps for audit, configuration tracking, or troubleshooting.
33+
* Monitoring changes to Kubernetes resources over time (for example, drift detection or identifying failed deployments).
34+
* Correlating Kubernetes object changes with other telemetry in Elastic Observability (for example, linking a deployment update to an increase in application errors).
35+
36+
37+
## Get started
38+
39+
You can start collecting Kubernetes objects and events with just a few configuration steps.
40+
41+
### Basic configuration
42+
43+
The following example shows the minimal configuration required to start collecting Kubernetes events:
44+
45+
```yaml
46+
receivers:
47+
k8sobjects:
48+
auth_type: serviceAccount
49+
objects:
50+
- name: pods
51+
mode: pull
52+
interval: 15m
53+
label_selector: environment=production
54+
- name: deployments
55+
mode: watch
56+
```
57+
58+
### Include in a logs pipeline
59+
60+
Ensure the Kubernetes objects receiver is part of a `logs` pipeline:
61+
62+
```yaml
63+
service:
64+
pipelines:
65+
logs:
66+
receivers: [k8sobjects, filelog]
67+
processors: [batch]
68+
exporters: [elasticsearch]
69+
```
70+
71+
### Mixed configuration
72+
73+
This example demonstrates a more comprehensive setup that combines both collection modes and shows how to integrate the receiver into a complete pipeline:
74+
75+
```yaml
76+
receivers:
77+
k8sobjects:
78+
auth_type: serviceAccount
79+
objects:
80+
- name: pods
81+
mode: watch
82+
- name: deployments
83+
mode: pull
84+
interval: 10m
85+
86+
processors:
87+
batch: # Uses default batching settings
88+
89+
exporters:
90+
elasticsearch:
91+
endpoints: ["https://${ELASTICSEARCH_HOST}:443"]
92+
api_key: "${ELASTIC_API_KEY}"
93+
mapping_mode: otel
94+
timeout: 10s
95+
96+
service:
97+
pipelines:
98+
logs:
99+
receivers: [k8sobjects, filelog]
100+
processors: [batch]
101+
exporters: [elasticsearch]
102+
```
103+
104+
105+
## Caveats and limitations
106+
107+
Consider the following when deploying the Kubernetes objects receiver:
108+
109+
* Run only one Collector instance with this receiver enabled to avoid duplicate data.
110+
* High-frequency clusters can generate large event bursts. Use filters to reduce noise.
111+
* Use `label_selector` and `field_selector` to target only relevant resources.
112+
* Supports two authentication modes: `serviceAccount` and `kubeConfig`.
113+
* The Collector requires RBAC (Role-Based Access Control) permissions to list or watch the specified resources.
114+
* Custom resources require the corresponding CRDs (Custom Resource Definitions) to be present in the cluster.
115+
* This receiver is marked as **beta** in the contrib repository. APIs and fields may change.
116+
117+
118+
## Resources
119+
120+
For contrib details, refer to the [OpenTelemetry k8sobjectsreceiver README](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/k8sobjectsreceiver).

docs/reference/edot-collector/toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ toc:
1919
- file: components/k8sclusterreceiver.md
2020
- file: components/elasticapmprocessor.md
2121
- file: components/filelogreceiver.md
22+
- file: components/k8sobjectsreceiver.md
2223
- file: components/hostmetricsreceiver.md
2324
- file: customization.md
2425
children:

0 commit comments

Comments
 (0)