Repository navigation
Keep standalone runtime monitoring out of Pod-metadata retries #4717
Description
🤖 Generated by the Agentic Engineer
Description
Kubescape's runtime callbacks request Kubernetes Pod metadata for standalone runtime containers that have no Pod identity. This produces failed metadata retries and stops the rule-manager registration before its normal monitoring lifecycle. Keep standalone monitoring separate from Kubernetes enrichment instead of suppressing the resulting errors.
Steps to Reproduce
- Register a non-host, standalone runtime container with an empty Kubernetes namespace and Pod name.
- Exercise the real container-watcher and rule-manager callbacks with bounded fake Kubernetes/cache dependencies.
- Observe the Pod lookup with an empty identity and the rule-manager wait for shared Kubernetes metadata that cannot be populated.
These steps describe a required regression reproduction, not a claim that an executable regression test has already been completed.
Expected Behavior
Standalone registrations retain their supported context and monitoring lifecycle without asking for a nonexistent Kubernetes Pod. Genuine Kubernetes registrations keep their enrichment, retries and failure reporting. Removal and shutdown terminate the affected registration cleanly.
Actual Behavior
The public container-watcher callback bypasses Pod enrichment only for the virtual host container. The rule-manager entrypoint likewise bypasses its shared-data wait only for that host identity, although the context detector explicitly supports standalone registrations. The same distinction remains in upstream main at this investigation.
Acceptance Criteria
- Reproduce both callback failures with the real entrypoints before changing behavior; distinguish standalone identity from delayed or incomplete Kubernetes enrichment.
- Correct the owning implementation with narrowly scoped lifecycle tests, including removal/re-add and shutdown where relevant.
- Preserve virtual-host monitoring, real Kubernetes metadata errors, runtime alert delivery and every existing security check; no severity downgrade or collector disablement.
- Carry the reviewed fix through a reproducible, pinned and signed platform image if an upstream release is not yet available.
- Validate CI, current-head review, merge and deployment; verify a fresh observation window and actual monitoring coverage rather than only the absence of log errors.
Additional Context
Part of #2447. This is separate from the exited-container and API-conflict classification handled by the existing compatibility patch. Public evidence is limited to upstream source and synthetic reproduction design; production logs, identities and topology remain private. Upstream contribution authority is being requested separately.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Effort
Projects
- StatusShow more project fields📥 Backlog
Activity
devantler commentedon Oct 11, 2026
The approved upstream repair is submitted as kubescape/node-agent#1026. It skips Pod metadata retries only when a container has no addressable Pod and preserves runtime monitoring, normal Kubernetes errors, and removal after metadata enrichment.
The complete source diff passed a fresh review; exact contribution head 5d6287e0c14c2f8f64908d9a82f1aa02bd7c9d48 passed Linux race tests and vet in https://github.com/devantler/node-agent/actions/runs/38097661265.
This is an upstream handoff, not a deployed platform fix. Keep this issue open until upstream merge, release adoption, and live verification.