Skip to content

feat(k8snode): link cilium-cni logs in container runtime logs to Pods - #1260

Merged
kyasbal merged 3 commits into
push-ustqwvvvkroyfrom
push-ottutrxmkoxp
Nov 17, 2026
Merged

kyasbal merged 3 commits into
push-ustqwvvvkroyfrom
push-ottutrxmkoxp

Conversation

@kyasbal

@kyasbal kyasbal commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Links the cilium-cni plugin logs written into the container runtime (containerd) log to the timelines of their Pods, and makes their summaries easier to read.

Stacked on #1259. Part of the GKE Dataplane V2 log support stack.

Motivation

containerd writes the logs of the GKE Dataplane V2 CNI plugin into its own log in logfmt, with subsys=cilium-cni, k8sNamespace and k8sPodName fields. Previously these logs were linked to a Pod only when the pod sandbox ID could be resolved from a RunPodSandbox log in the inspected range, or when audit logs knew the Pod UID. Endpoint setup and teardown errors (for example deleteEndpointNotFound or Unable to open network namespace) often did not appear on the Pod they belong to.

Changes

  • Added isCiliumCNILog and findCiliumCNIPodReference in k8snode/impl/parser_utility.go.
  • processK8sNodeLog:
    • Prefixes the summary of every cilium-cni log with [cilium-cni], and trims the trailing space that the plugin can leave in its messages.
    • Appends the Pod from k8sNamespace and k8sPodName. A pod sandbox ID or a Pod UID that resolves to the same Pod is not appended again in another format.
  • mapContainerdLog: always adds the log to the timeline of the Pod written in the log.
before: NewCreationFallbackClient tryConnect() succeeded
after : [cilium-cni] NewCreationFallbackClient tryConnect() succeeded 【test-pod (Namespace: kube-system)】
before: Fast start health check grace period active.
after : [cilium-cni] Fast start health check grace period active.

Screenshots

Verified on real container runtime logs: 539 cilium-cni logs, each linked to the Pod timeline, the owner alias and the containerd timeline.

📷 Screenshot — e2e_pod_lifecycle_cilium.png: lifecycle of a single Pod, with cilium-cni connection and teardown logs (E2, E4) next to the cilium-agent endpoint logs (#1261), the network policy denial (#1259) and the CiliumEndpoint alias (#1262).

image

Verification

  • make pre-commit
  • make build-go && make lint-go && make test-go
  • Ran the Kubernetes node logs feature on real Dataplane V2 container runtime logs and checked the summaries and the Pod timelines with the KHI MCP tools.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for parsing and processing cilium-cni plugin logs from containerd. It adds utility functions to identify cilium-cni logs and extract their pod references, updates the log processor to include these details in the log summary without duplication, and links the logs to the corresponding pod timeline. Comprehensive unit tests are also added. The reviewer suggested using a case-insensitive comparison (strings.EqualFold) when checking the Kubernetes resource kind to ensure robustness.

containerd writes the logs of the cilium-cni plugin of GKE Dataplane V2 into the container runtime log in logfmt with the subsys, k8sNamespace and k8sPodName fields. Previously these logs were linked to Pods only when the pod sandbox ID was resolvable from a RunPodSandbox log in the inspected range or the Pod UID was known from audit logs.

Use the Pod fields to always add the log to the timeline of the Pod. Prefix the summary of every cilium-cni log with the subsystem, and append the Pod name without appending the Pod again when the pod sandbox ID or the Pod UID in the log resolves to the same Pod.
@github-actions

Copy link
Copy Markdown

Code Quality Report — ✅ Cloud Build success

Cloud Build completed without an embedded report envelope.


Commit: fcf7d2522b96 · Cloud Build Logs

@kyasbal
kyasbal added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 3f442ad Nov 17, 2026
22 checks passed
@kyasbal
kyasbal deleted the push-ottutrxmkoxp branch November 17, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant