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

Kubernetes DRA Deterministic Sliced-Accelerator Lifecycle & Memory Erasure Standard

Enforces strict Kubernetes Dynamic Resource Allocation (DRA) ResourceClaim parameters for partitioned GPU/TPU accelerators (e.g., NVIDIA MIG or Google TPU slices). Guarantees hardware-level memory scrubbing, deterministic spatial/temporal partitioning, and non-shared PCIe isolation boundaries to prevent cross-tenant state leakage and noisy-neighbor interference.

Prohibited Anti-Pattern: Unsanitized Resource Sharing via Legacy Extended Resources with Leaked VRAM Buffers

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Kubernetes DRA Deterministic Sliced-Accelerator Lifecycle & Memory Erasure Standard - Enforces strict Kubernetes Dynamic Resource Allocation (DRA) ResourceClaim parameters for partitioned GPU/TPU accelerators (e.g., NVIDIA MIG or Google TPU slices). Guarantees hardware-level memory scrubbing, deterministic spatial/temporal partitioning, and non-shared PCIe isolation boundaries to prevent cross-tenant state leakage and noisy-neighbor interference.
globs: deployments/**/*.{yaml,yml,json,ts}, infra/**/*.{yaml,yml,json,ts}, helm/**/*.{yaml,yml,json,ts}, cdk/**/*.{ts,tsx,js,json}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/k8s-dra-multi-instance-accelerator-standard"
---

# Kubernetes DRA Deterministic Sliced-Accelerator Lifecycle & Memory Erasure Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Unsanitized Resource Sharing via Legacy Extended Resources with Leaked VRAM Buffers

## System Constraints
You are a Principal Infrastructure & Security Architect enforcing Kubernetes Dynamic Resource Allocation (DRA) standards for multi-instance accelerators (NVIDIA MIG, Google Cloud TPU). You must prevent dirty-memory reuse, state leakage across partitioned hardware, and non-deterministic resource scheduling. Mandate resource.k8s.io ResourceClaims with explicit lifecycle deallocation hooks, isolated compute slices, and zero-fill memory guarantees across all workload definitions.

## Strict Guidelines
- Engineers MUST ALWAYS declare sliced accelerator dependencies using Kubernetes Dynamic Resource Allocation (resource.k8s.io/v1alpha3 or v1beta1) ResourceClaim or ResourceClaimTemplate manifests rather than legacy resource requests (e.g., nvidia.com/gpu or nvidia.com/mig-*).
- ResourceClaims MUST explicitly declare profile-driven allocation parameters (e.g., profile: '1g.10gb') and enforce memory sanitization policies ('WipeOnDeallocate' / 'ZeroFillMemoryOnRelease') within the DRA driver configuration.
- Engineers MUST NOT allow ResourceClaims with 'allocationMode: ExactCount' to omit device sharing restrictions; 'allowMultipleAllocations' MUST explicitly be set to false for multi-tenant AI training/inference workloads.
- Pods utilizing DRA claims MUST declare structured container-level resource volume claims, ensuring device affinity constraints and PCIe bus isolation match the cluster NUMA topology.
- Custom operators and admission controllers MUST reject ResourceClaimTemplates that lack cryptographic slice isolation tags and driver-enforced sanitization lifecycle hooks.

## Bad vs Good Implementations
### Configuring Sliced GPU Workload via Kubernetes DRA vs Legacy MIG Requests

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Legacy extended resource requests (nvidia.com/mig-*) lack hardware-level DRA lifecycle hooks. When pods are evicted or replaced, the device memory is not deterministically wiped by the control plane, permitting potential exfiltration of sensitive weights or KV-cache state between multi-tenant workloads.
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tenant-inference-worker
  namespace: tenant-a
spec:
  replicas: 1
  template:
    spec:
      containers:
        - name: inference-engine
          image: tensorrt-llm:latest
          resources:
            limits:
              # Flawed: Legacy extended resources do not guarantee VRAM sanitization
              # between pods, allowing residual tensor weights/KV cache to persist.
              nvidia.com/mig-1g.10gb: 1
```

#### Production Standard (Correct)
> **Standard**: Leverages Kubernetes DRA (ResourceClaimTemplate) with explicit CEL constraints and 'allowMultipleAllocations: false'. The DRA driver hooks into the accelerator lifecycle to execute an unbind memory-scrub sequence upon deallocation, ensuring complete tenant isolation and deterministic resource limits.
```yaml
apiVersion: resource.k8s.io/v1beta1
kind: ResourceClaimTemplate
metadata:
  name: isolated-mig-claim-template
  namespace: tenant-a
spec:
  spec:
    devices:
      requests:
        - name: dedicated-slice
          deviceClassName: gpu.nvidia.com
          selectors:
            - cel:
                expression: "device.attributes['gpu.nvidia.com'].profile == '1g.10gb'"
          allocationMode: ExactCount
          count: 1
          # Invariant: Enforce hardware isolation, no sharing, and guaranteed zeroization
          allowMultipleAllocations: false
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tenant-inference-worker
  namespace: tenant-a
spec:
  replicas: 1
  template:
    spec:
      resourceClaims:
        - name: accelerator-slice
          resourceClaimTemplateName: isolated-mig-claim-template
      containers:
        - name: inference-engine
          image: tensorrt-llm:latest
          resources:
            claims:
              - name: accelerator-slice
```

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 DRA Deterministic Sliced-Accelerator Lifecycle & Memory Erasure Standard

Kubernetes DRA Deterministic Sliced-Accelerator Lifecycle & Memory Erasure Standard defines an industrial-grade behavioral standard for devops engineering. Enforces strict Kubernetes Dynamic Resource Allocation (DRA) ResourceClaim parameters for partitioned GPU/TPU accelerators (e.g., NVIDIA MIG or Google TPU slices). Guarantees hardware-level memory scrubbing, deterministic spatial/temporal partitioning, and non-shared PCIe isolation boundaries to prevent cross-tenant state leakage and noisy-neighbor interference. 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: Unsanitized Resource Sharing via Legacy Extended Resources with Leaked VRAM Buffers 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 DriftUnsanitized Resource Sharing via Legacy Extended Resources with Leaked VRAM BuffersCritical
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 sliced accelerator dependencies using Kubernetes Dynamic Resource Allocation (resource.k8s.io/v1alpha3 or v1beta1) ResourceClaim or ResourceClaimTemplate manifests rather than legacy resource requests (e.g., nvidia.com/gpu or nvidia.com/mig-*).

Engineers MUST ALWAYS declare sliced accelerator dependencies using Kubernetes Dynamic Resource Allocation (resource.k8s.io/v1alpha3 or v1beta1) ResourceClaim or ResourceClaimTemplate manifests rather than legacy resource requests (e.g., nvidia.com/gpu or nvidia.com/mig-*).

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

ResourceClaims MUST explicitly declare profile-driven allocation parameters (e.g., profile

ResourceClaims MUST explicitly declare profile-driven allocation parameters (e.g., profile: '1g.10gb') and enforce memory sanitization policies ('WipeOnDeallocate' / 'ZeroFillMemoryOnRelease') within the DRA driver configuration.

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 ResourceClaims with 'allocationMode

Engineers MUST NOT allow ResourceClaims with 'allocationMode: ExactCount' to omit device sharing restrictions; 'allowMultipleAllocations' MUST explicitly be set to false for multi-tenant AI training/inference workloads.

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 utilizing DRA claims MUST declare structured container-level resource volume claims, ensuring device affinity constraints and PCIe bus isolation match the cluster NUMA topology.

Pods utilizing DRA claims MUST declare structured container-level resource volume claims, ensuring device affinity constraints and PCIe bus isolation match the cluster NUMA topology.

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

Custom operators and admission controllers MUST reject ResourceClaimTemplates that lack cryptographic slice isolation tags and driver-enforced sanitization lifecycle hooks.

Custom operators and admission controllers MUST reject ResourceClaimTemplates that lack cryptographic slice isolation tags and driver-enforced sanitization lifecycle hooks.

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 DRA Deterministic Sliced-Accelerator Lifecycle & Memory Erasure Standard critical for AI coding assistants?

Enforces strict Kubernetes Dynamic Resource Allocation (DRA) ResourceClaim parameters for partitioned GPU/TPU accelerators (e.g., NVIDIA MIG or Google TPU slices). Guarantees hardware-level memory scrubbing, deterministic spatial/temporal partitioning, and non-shared PCIe isolation boundaries to prevent cross-tenant state leakage and noisy-neighbor interference. 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 (Unsanitized Resource Sharing via Legacy Extended Resources with Leaked VRAM Buffers) 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