Skip to content

Keep standalone runtime monitoring out of Pod-metadata retries #4717

Description

@devantler

🤖 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

  1. Register a non-host, standalone runtime container with an empty Kubernetes namespace and Pod name.
  2. Exercise the real container-watcher and rule-manager callbacks with bounded fake Kubernetes/cache dependencies.
  3. 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.

Activity

  1. added theissue type on Oct 10, 2026
  2. devantler commented on Oct 11, 2026

    @devantler
    ContributorAuthor

    🤖 Generated by the Agentic Engineer

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions