Skip to content

fix(k8s): Put a NetworkPolicy on gpu-feature-discovery #6109

Not planned

Description

@dan-petty

Problem

No NetworkPolicy selects the pods of the DaemonSet default/gpu-feature-discovery (k8s/gpu-feature-discovery/daemonset.yaml). Namespace default has no NetworkPolicy, so the privileged pod can open any connection. The kube-linter row of devops ci (#6068) reports non-isolated-pod for it, and the DaemonSet holds the exception annotation ignore-check.kube-linter.io/non-isolated-pod until this item.

The pod mounts no ServiceAccount token. It reads the GPUs and /sys of its node and writes the GPU features to a file of the node. It should need no network connection, but no one has checked this on a GPU node.

Expected behavior

  • Confirm on a GPU node which connections the pod opens, if any.
  • Add a NetworkPolicy that selects the pod and allows only those connections (none, if it needs none), and add it to the kustomization.
  • Remove the annotation ignore-check.kube-linter.io/non-isolated-pod from the DaemonSet. uv run devops k8s lint passes, and the GPU labels of each GPU node stay after a restart of the pod.

Related

Alternatives check of 2026-11-24: partly.
Tool: inspektor-gadget/inspektor-gadget (https://github.com/inspektor-gadget/inspektor-gadget), Apache-2.0, last activity 2026-11-24, maintained.
Reason: Searches found no tool that writes the NetworkPolicy; Inspektor Gadget, an eBPF tracing tool, can show the connections the gpu-feature-discovery pod opens on a node, but it writes no policy and touches neither the kustomization nor the kube-linter annotation.

Covers:

  • Shows which endpoints a running pod connects to
  • Traces traffic per pod on each node
  • No change to the workload manifest required

Lacks:

  • No NetworkPolicy manifest generation
  • No kustomization entry or annotation removal
  • No lint or rendered-kustomization check

Proposed design

Problem statement

Namespace default has no NetworkPolicy that selects the gpu-feature-discovery pods. Kube-linter reports non-isolated-pod, and the DaemonSet hides it with an exception annotation. This change adds a default-deny NetworkPolicy, includes it in the kustomization, and removes the annotation. A check of the pod's connections and GPU labels on a GPU node is deferred because it needs that hardware.

Acceptance criteria

Requirement: GPU feature discovery network policy

The default/gpu-feature-discovery pods SHALL be selected by a NetworkPolicy that allows no ingress or egress traffic.

Scenario: Kube-linter accepts the isolated pod

  • WHEN uv run devops k8s lint runs on the changed kustomization
  • THEN the command passes and reports no non-isolated-pod finding for default/gpu-feature-discovery.

Requirement: Kustomization includes the network policy

The kustomization that renders k8s/gpu-feature-discovery/daemonset.yaml MUST include the new NetworkPolicy manifest.

Scenario: The k8s check renders the policy

  • WHEN uv run devops ci --check --only k8s runs
  • THEN the command passes and the render contains the default/gpu-feature-discovery NetworkPolicy.

Requirement: Kube-linter exception is removed

The DaemonSet MUST NOT hold the ignore-check.kube-linter.io/non-isolated-pod annotation.

Scenario: The lint row passes without the exception

  • WHEN uv run devops k8s lint runs after the annotation is removed
  • THEN the command passes and reports no non-isolated-pod finding.

Existing Tool Considered

Inspektor Gadget (partly) - the alternatives check in the issue body records what it covers and lacks. The proposal writes the NetworkPolicy manifest, adds the kustomization entry, removes the kube-linter annotation, and verifies with uv run devops k8s lint; Inspektor Gadget supplies none of these.

Key questions

  • Which traffic must the NetworkPolicy allow for the gpu-feature-discovery pod?: Allow no ingress and no egress. The pod mounts no ServiceAccount token, reads /sys, and writes the node feature file; the command has no network client. (best practice) [sources: k8s/gpu-feature-discovery/daemonset.yaml, docs/SERVICE_PATTERNS.md]
    • Chosen: Default-deny all ingress and egress. The pod spec shows no token and only host file mounts; the issue states the pod should need no network.
    • Rejected: Allow DNS egress. The pod spec names no service and no API call.
    • Rejected: Allow ingress from kubelet. The pod serves no endpoint and has no probe.
  • Which pod labels must the NetworkPolicy select?: Select app.kubernetes.io/name: gpu-feature-discovery and app.kubernetes.io/part-of: nvidia-gpu, the labels of the pod template. [sources: k8s/gpu-feature-discovery/daemonset.yaml]
  • Must the change remove the ignore-check.kube-linter.io/non-isolated-pod annotation?: Yes. Remove it in the same change. The annotation text says it lasts until fix(k8s): Put a NetworkPolicy on gpu-feature-discovery #6109, and a kept annotation hides a missing policy. (best practice) [sources: k8s/gpu-feature-discovery/daemonset.yaml, docs/SERVICE_PATTERNS.md]
    • Chosen: Remove the annotation in this change. The annotation names this issue as its end, and the new policy replaces the exception.
    • Rejected: Keep the annotation until the GPU-node check. The exception would hide a missing or wrong policy from the lint row.
  • Which command validates the manifest change?: Use uv run devops k8s lint for the kube-linter row and uv run devops ci --check --only k8s for the rendered kustomization. [sources: docs/SERVICE_PATTERNS.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/k8s
    source/agent
    status/new
    value/medium
    on Nov 17, 2026
  2. dan-petty commented on Nov 17, 2026

    @dan-petty
    OwnerAuthor
  3. added
    effort/low
    priority/p2-medium
    on Nov 17, 2026
  4. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • gpu-feature-discovery DaemonSet NetworkPolicy, results: 5
    • generate Kubernetes NetworkPolicy from observed traffic open source tool, results: 5
    • np-guard network policy generator Kubernetes IBM, results: 5
    • Kubernetes network policy generator tool automatically generate from cluster traffic, results: 5
    • kube-linter non-isolated-pod NetworkPolicy, results: 5
    • np-guard github network policy, results: 5
    • Cilium network policy editor, results: 5
    • np-guard, results: 5
    • np-guard network policy generator github repository, results: 5
    • Inspektor Gadget advise networkpolicy gadget generate network policy, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  6. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 4ddf77e (see proposed design in issue body).

    Moved to new items: #6321.

  7. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Superseded by #7252: gpu-feature-discovery labelled nothing, and it is removed from the cluster (dan-petty/homelab#234) and from deploy-stack (#7253). Its copy of the manifest in this repository goes with step 17 of #5134.

  8. removed
    status/ready
    on Nov 25, 2026
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

    effort/lowpriority/p2-mediumscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions