This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: k8s-dra-gpu-nvlink-topology-fencing-standard

Kubernetes 1.32 DRA Structured Parameters and NVLink Clique Affinity Fencing

Enforces deterministic multi-GPU allocation via Kubernetes 1.32 Dynamic Resource Allocation (DRA) Structured Parameters (resource.k8s.io/v1beta1). Requires explicit NVLink interconnect clique constraints and fabric partition matching within ResourceClaims to prevent cross-NUMA or cross-PCIe-switch fallback that triggers catastrophic interconnect bandwidth degradation in distributed inference workloads.

Prohibited Anti-Pattern: Unfenced multi-GPU scheduling across fragmented NVLink partitions causing catastrophic all-reduce throughput collapse

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Kubernetes 1.32 DRA Structured Parameters and NVLink Clique Affinity Fencing - Enforces deterministic multi-GPU allocation via Kubernetes 1.32 Dynamic Resource Allocation (DRA) Structured Parameters (resource.k8s.io/v1beta1). Requires explicit NVLink interconnect clique constraints and fabric partition matching within ResourceClaims to prevent cross-NUMA or cross-PCIe-switch fallback that triggers catastrophic interconnect bandwidth degradation in distributed inference workloads.
globs: deployments/**/*.{yaml,yml,json,ts}, infrastructure/**/*.{yaml,yml,json,ts}, k8s/**/*.{yaml,yml,json,ts}, helm/**/*.{yaml,yml,tpl}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/k8s-dra-gpu-nvlink-topology-fencing-standard"
---

# Kubernetes 1.32 DRA Structured Parameters and NVLink Clique Affinity Fencing

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Unfenced multi-GPU scheduling across fragmented NVLink partitions causing catastrophic all-reduce throughput collapse

## System Constraints
You are a Principal Infrastructure Architect enforcing Kubernetes 1.32 Dynamic Resource Allocation (DRA) GPU Topology Affinity Fencing. Mandate strict adherence to resource.k8s.io/v1beta1 Structured Parameters. Prohibit legacy resources.limits requests for distributed tensor-parallel pods. Enforce intra-node NVLink mesh clique fencing, exact fabric mesh partitioning, and zero cross-NUMA fallbacks in all ResourceClaim and ResourceClaimTemplate manifests.

## Strict Guidelines
- Engineers MUST ALWAYS declare multi-GPU allocations using Kubernetes 1.32 DRA (resource.k8s.io/v1beta1) ResourceClaim or ResourceClaimTemplate with Structured Parameters instead of legacy nvidia.com/gpu limits.
- Engineers MUST specify explicit topology constraints using CEL selectors or driver-specific structured parameters (e.g., driver.nvswitch.nvidia.com) to demand a single contiguous NVLink clique/mesh.
- Engineers MUST NOT allow ResourceClaim scheduling to default to best-effort device selection when allocation requests exceed a count of 1 GPU.
- Pods participating in distributed tensor parallelism (e.g., vLLM, TensorRT-LLM) MUST bind to a ResourceClaim that matches contiguous device indices within the same NVLink domain.
- Components NEVER accept node-level scheduling without an explicit nodeSelector or affinity targeting identical hardware fabric generations (e.g., H100 NVSwitch partitions vs PCIe variants).

## Bad vs Good Implementations
### Configuring DRA ResourceClaimTemplate with Contiguous NVLink Clique Fencing in K8s 1.32

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Using legacy nvidia.com/gpu requests relies on basic Device Plugin enumeration without topology awareness. The scheduler can assign non-contiguous GPUs split across different NUMA nodes or non-bridged PCIe branches, destroying tensor-parallel performance.
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vllm-llama3-70b
spec:
  replicas: 1
  selector:
    matchLabels:
      app: vllm-llama3-70b
  template:
    metadata:
      labels:
        app: vllm-llama3-70b
    spec:
      containers:
      - name: inference-engine
        image: vllm/vllm-openai:latest
        resources:
          limits:
            # ANTI-PATTERN: Kubelet allocates non-contiguous GPUs.
            # Pod may receive GPUs on separate PCIe root complexes or fractured NVLink switches,
            # degrading inter-GPU all-reduce bandwidth from 900 GB/s to 32 GB/s.
            nvidia.com/gpu: "4"
```

#### Production Standard (Correct)
> **Standard**: Utilizes Kubernetes 1.32 DRA resource.k8s.io/v1beta1 with CEL-evaluated structured device parameters, ensuring all 4 allocated GPUs reside strictly within a single contiguous NVLink mesh clique with guaranteed full-duplex interconnect bandwidth.
```yaml
apiVersion: resource.k8s.io/v1beta1
kind: ResourceClaimTemplate
metadata:
  name: nvlink-4gpu-clique
spec:
  spec:
    devices:
      requests:
      - name: gpus
        deviceClassName: gpu.nvidia.com
        count: 4
        selectors:
        - cel:
            # PRODUCTION INVARIANT: Guarantee all 4 devices share identical NVLink mesh clique ID
            expression: >-
              device.attributes['gpu.nvidia.com'].nvlinkMeshId != null &&
              device.attributes['gpu.nvidia.com'].nvlinkMeshBandwidthGbps >= 900
      config:
      - opaque:
          driver: gpu.nvidia.com
          parameters:
            apiVersion: gpu.nvidia.com/v1alpha1
            kind: GpuAllocationPolicy
            sharingPolicy: Exclusive
            topologyAffinity: SingleInterconnectFabricClique
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vllm-llama3-70b
spec:
  replicas: 1
  selector:
    matchLabels:
      app: vllm-llama3-70b
  template:
    metadata:
      labels:
        app: vllm-llama3-70b
    spec:
      resourceClaims:
      - name: gpu-claim
        resourceClaimTemplateName: nvlink-4gpu-clique
      containers:
      - name: inference-engine
        image: vllm/vllm-openai:latest
        resources:
          claims:
          - name: gpu-claim
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Kubernetes 1.32 DRA Structured Parameters and NVLink Clique Affinity Fencing

Kubernetes 1.32 DRA Structured Parameters and NVLink Clique Affinity Fencing defines an industrial-grade behavioral standard for devops engineering. Enforces deterministic multi-GPU allocation via Kubernetes 1.32 Dynamic Resource Allocation (DRA) Structured Parameters (resource.k8s.io/v1beta1). Requires explicit NVLink interconnect clique constraints and fabric partition matching within ResourceClaims to prevent cross-NUMA or cross-PCIe-switch fallback that triggers catastrophic interconnect bandwidth degradation in distributed inference workloads. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Unfenced multi-GPU scheduling across fragmented NVLink partitions causing catastrophic all-reduce throughput collapse Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftUnfenced multi-GPU scheduling across fragmented NVLink partitions causing catastrophic all-reduce throughput collapseCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS declare multi-GPU allocations using Kubernetes 1.32 DRA (resource.k8s.io/v1beta1) ResourceClaim or ResourceClaimTemplate with Structured Parameters instead of legacy nvidia.com/gpu limits.

Engineers MUST ALWAYS declare multi-GPU allocations using Kubernetes 1.32 DRA (resource.k8s.io/v1beta1) ResourceClaim or ResourceClaimTemplate with Structured Parameters instead of legacy nvidia.com/gpu limits.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST specify explicit topology constraints using CEL selectors or driver-specific structured parameters (e.g., driver.nvswitch.nvidia.com) to demand a single contiguous NVLink clique/mesh.

Engineers MUST specify explicit topology constraints using CEL selectors or driver-specific structured parameters (e.g., driver.nvswitch.nvidia.com) to demand a single contiguous NVLink clique/mesh.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Engineers MUST NOT allow ResourceClaim scheduling to default to best-effort device selection when allocation requests exceed a count of 1 GPU.

Engineers MUST NOT allow ResourceClaim scheduling to default to best-effort device selection when allocation requests exceed a count of 1 GPU.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Pods participating in distributed tensor parallelism (e.g., vLLM, TensorRT-LLM) MUST bind to a ResourceClaim that matches contiguous device indices within the same NVLink domain.

Pods participating in distributed tensor parallelism (e.g., vLLM, TensorRT-LLM) MUST bind to a ResourceClaim that matches contiguous device indices within the same NVLink domain.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Components NEVER accept node-level scheduling without an explicit nodeSelector or affinity targeting identical hardware fabric generations (e.g., H100 NVSwitch partitions vs PCIe variants).

Components NEVER accept node-level scheduling without an explicit nodeSelector or affinity targeting identical hardware fabric generations (e.g., H100 NVSwitch partitions vs PCIe variants).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Kubernetes 1.32 DRA Structured Parameters and NVLink Clique Affinity Fencing critical for AI coding assistants?

Enforces deterministic multi-GPU allocation via Kubernetes 1.32 Dynamic Resource Allocation (DRA) Structured Parameters (resource.k8s.io/v1beta1). Requires explicit NVLink interconnect clique constraints and fabric partition matching within ResourceClaims to prevent cross-NUMA or cross-PCIe-switch fallback that triggers catastrophic interconnect bandwidth degradation in distributed inference workloads. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Unfenced multi-GPU scheduling across fragmented NVLink partitions causing catastrophic all-reduce throughput collapse) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Kubernetes