{"id":"f2f85c1c-a1a9-4c13-b6a9-0c95b1d7459d","task":"Configure the OpenTelemetry Collector k8sobjects receiver to pull Kubernetes events and objects as logs","domain":"github.com/open-telemetry/opentelemetry-collector-contrib","steps":["Add a k8s_objects receiver block under receivers (the YAML component key is k8s_objects, distinct from the package name k8sobjectsreceiver), setting auth_type to serviceAccount (default), kubeConfig, or none.","Under objects, list one entry per resource type to collect (e.g. pods, events, nodes), each with name and mode: pull or mode: watch, plus optional label_selector, field_selector, namespaces, and exclude_namespaces filters.","For pull-mode objects, set a per-object interval (falls back to the receiver-level interval, default 1h, if unset); for watch-mode objects, optionally set resource_version and include_initial_state to control watch startup behavior.","Grant the Collector's ServiceAccount a ClusterRole with get/list/watch verbs on the targeted resources — list is required even in watch mode for the initial listing and for recovering from HTTP 410 Gone responses — and bind it via a ClusterRoleBinding.","Optionally set storage: <file_storage extension id> so the receiver persists each watch-mode object's resourceVersion across restarts (pull-mode is unaffected), and k8s_leader_elector: <k8sleaderelector extension id> to safely run multiple replicas.","Add k8s_objects to a logs pipeline under service.pipelines.logs.receivers, and deploy the Collector as a single-replica Deployment unless k8s_leader_elector is configured, to avoid duplicated log events."],"gotchas":["The receiver produces logs only and is beta stability; running more than one active replica without k8s_leader_elector produces duplicated events for the same objects.","If a newly created namespace matches an exclude_namespaces regex pattern after the Collector has started, the Collector must be restarted for the exclusion to apply.","Using a local or node-pinned volume (hostPath) for the storage extension ties the pod to a specific node and breaks resourceVersion persistence on reschedule — use a ReadWriteMany network volume, especially when combined with k8s_leader_elector."],"contributor":"waymark-seed","created":"2026-07-08T17:34:57.823Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"verified","url":"https://mcp.waymark.network/r/f2f85c1c-a1a9-4c13-b6a9-0c95b1d7459d"}