← Back to Pull requests

Isolate nodes in Kubernetes with an IMDS event controller #1292

Open
unknown opened this pull request with 442 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 01, 2026 01:33 UTC
Author

Issue #, if available: N/A

Description of changes:

This PR is split from #1290, along with #1291.
It depends on #1291 and includes its commit until that PR merges.

With this change to IMDS mode, no node's NTH pod can cordon, drain or modify any other node: it can only report its own node's events.
Node isolation is enforced at the Kubernetes layer with admission policy.
Previously, every node ran a pod whose service account could cordon and drain every node in the cluster.

  • The DaemonSet only reports its node's IMDS events, in an annotation on its own Node, under its own service account.

  • A ValidatingAdmissionPolicy allows that service account to change only that annotation, on the node its pod runs on, and to record events only about that node.

  • RBAC alone cannot scope a permission to the caller's node.
  • A leader-elected Deployment, the IMDS event controller, cordons, taints and drains the nodes with the existing logic and settings.

  • The controller takes node identity from the Node object, never from a report.

  • It acts on a report only while the reporting pod runs on that node and the report's boot ID is the node's current one.
  • The controller treats the report as untrusted: it drops events with unexpected fields and generates event descriptions itself.

  • Since the controller cannot read another node's uptime, it detects reboots from the node's boot ID.

  • Webhooks and Kubernetes events carry the interrupted node's metadata, from its Node object; the report adds only the account ID and instance life cycle.

  • On by default in the chart. docs/imds_event_controller.md covers the design, permissions, tested policy cases and behavior differences.
  • Upgrading: the chart now requires Kubernetes 1.30 or later and rbac.create=true in IMDS mode.
    On older clusters, or with rbac.create=false, set imdsEventController.enabled=false to keep the old self-draining DaemonSet.

    How you tested your changes:
    Environment (Linux / Windows): Linux (arm64 nodes, AL2023)
    Kubernetes Version: EKS 1.36 (eksctl, EKS Pod Identity); kube-apiserver 1.35 for the admission policy tests

    The EKS and AWS FIS tests ran before the report validation and Node-sourced metadata were added.

  • IMDS mode on EKS, with AEMM simulating a spot notice: only the target node reported, and the controller drained it once.

  • Admission on EKS: using a token the EKS API server issued, the DaemonSet's service account was denied writes to another node and to its own node's spec and labels.

  • Stale reports: a report left by a DaemonSet pod that no longer runs on its node was ignored.

  • A real spot interruption from AWS FIS: the controller drained the spot node before shutdown.

  • Admission policy: each allowed and denied case run against kube-apiserver 1.35 with pod-bound tokens, and each denial checked against the rule that produced it.

  • e2e suite (kind, Kubernetes 1.32–1.35): the IMDS tests run in controller mode and read both the DaemonSet's and the controller's logs.

  • The reboot test stays in the old mode, because it fakes a reboot with an uptime file and kind's boot ID never changes.
  • Unit and static checks: go test ./... (including forged report fields), go vet, shellcheck, helm lint, and helm template for each mode, including Kubernetes 1.29 being rejected.

  • Not tested: Windows nodes, and real (non-AEMM) scheduled maintenance events.
  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    Diff: 442 lines (+331 / -111) across 5 files Reviewer: micahhausler Review duration: 42625m
    All Vouch review confidence checks passed
    Residual risk 0.41 = Change Risk (0.68) × (1 − Review Confidence (0.40)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.68 · 442 lines diff across 5 files
    0.68
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.365
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.068
    Real PR Conversation Timeline
    1 comments
    "Review active on #1292"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 40.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.5% (HIGH) · Higher = larger blast radius
    68.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.5% · Lower = rushed or shallow review
    40.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 40.8% · Moderate risk
    40.8%