This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: k8s-gamma-ambient-cross-cluster-failover-standard

GAMMA Ambient Multi-Cluster Failover & L7 Outlier Circuit Breaking Standard

Enforces strict declarative L7 east-west traffic failover and real-time outlier detection across multi-cluster service meshes using Kubernetes Gateway API GAMMA specifications and sidecarless ambient waypoints. Eliminates split-brain outages and client DNS caching bottlenecks by replacing DNS TTL-based shifting with kernel/waypoint-level active-passive circuit breaking.

Prohibited Anti-Pattern: Relying on Client-Side DNS Resolution and Legacy Sidecars for Regional East-West Failover

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: GAMMA Ambient Multi-Cluster Failover & L7 Outlier Circuit Breaking Standard - Enforces strict declarative L7 east-west traffic failover and real-time outlier detection across multi-cluster service meshes using Kubernetes Gateway API GAMMA specifications and sidecarless ambient waypoints. Eliminates split-brain outages and client DNS caching bottlenecks by replacing DNS TTL-based shifting with kernel/waypoint-level active-passive circuit breaking.
globs: deploy/**/*.{yaml,yml}, k8s/**/*.{yaml,yml}, infra/**/*.{yaml,yml}, mesh/**/*.{yaml,yml}, helm/**/*.{yaml,yml}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/k8s-gamma-ambient-cross-cluster-failover-standard"
---

# GAMMA Ambient Multi-Cluster Failover & L7 Outlier Circuit Breaking Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Relying on Client-Side DNS Resolution and Legacy Sidecars for Regional East-West Failover

## System Constraints
You are a Principal DevOps and Mesh Architect enforcing the Kubernetes Gateway API GAMMA Cross-Cluster Ambient Failover Circuit Breaking Standard. You must reject any architecture that relies on sidecar injection (sidecar.istio.io/inject), client DNS TTL shifts, or ExternalName hacks for inter-cluster resiliency. Mandate Gateway API GAMMA constructs (HTTPRoute with Service parentRefs), ambient waypoint proxies, and declarative outlier detection policies targeting cross-cluster multi-cluster services (MCS) ServiceImports.

## Strict Guidelines
- Engineers MUST ALWAYS attach GAMMA-compliant HTTPRoute resources directly to the target Service as a parentRef, declaring local and cross-cluster ServiceImport destinations under backendRefs.
- Engineers MUST NOT rely on DNS failover, ExternalName services, or global load balancer DNS TTL manipulation for east-west cross-cluster service communication.
- Engineers MUST configure declarative outlier detection and circuit breaking at the ambient waypoint or gateway level with explicit consecutiveGatewayErrors, interval, and baseEjectionTime.
- Engineers MUST deploy dedicated waypoint proxies (ambient architecture) using 'istio.io/use-waypoint' or equivalent mesh gateway annotations rather than injecting L7 sidecars into workload pods.
- Multi-cluster failover routes MUST configure cross-region fallback endpoints with a zero-initial-weight active-passive policy or an automated outlier-triggered failover priority rule.
- Connection pool settings MUST enforce maxConnections, maxPendingRequests, and maxRequestsPerConnection limits to prevent cascading failure across cluster boundaries during regional degradation.
- Mesh infrastructure components NEVER bypass mutual TLS (mTLS) in transit across cluster boundaries; cross-cluster egress MUST traverse verified waypoint tunnel encapsulation.

## Bad vs Good Implementations
### Cross-Cluster Failover Routing via Gateway API GAMMA vs Legacy DNS Sidecar Architecture

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Legacy sidecar injection introduces heavy pod startup dependencies and resource overhead. Routing through unmanaged DNS external endpoints causes severe failover lag (due to client-side JVM/Node DNS caching) and lacks declarative circuit breaking, driving cascading failures across clusters.
```yaml
# ANTI-PATTERN: Sidecar-injected workload relying on DNS TTL failover and external endpoints
apiVersion: apps/v1
kind: Deployment
metadata:
  name: order-service
  namespace: production
  annotations:
    sidecar.istio.io/inject: "true" # Enforces heavy container sidecar lifecycle coupling
spec:
  template:
    spec:
      containers:
        - name: app
          image: order-service:v2.1.0
          env:
            # High-TTL DNS entry: client DNS caching hides regional node failures
            - name: PAYMENT_SERVICE_URL
              value: "http://payment.east.internal.corp:8080"
---
# Dangerous fallback using raw DNS ExternalName without outlier detection
apiVersion: v1
kind: Service
metadata:
  name: payment-failover
  namespace: production
spec:
  type: ExternalName
  externalName: payment.west.internal.corp # Unchecked failover leads to cascading load
```

#### Production Standard (Correct)
> **Standard**: Leverages Gateway API GAMMA semantics to bind the route directly to the target logical service while executing L7 policies on an ambient waypoint proxy. Automatically identifies degradation via aggressive outlier detection and switches traffic to cross-cluster ServiceImport without DNS TTL dependencies or workload sidecars.
```yaml
# PRODUCTION STANDARD: Gateway API GAMMA with Ambient Waypoint and Outlier Failover
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: payment-service-route
  namespace: production
  labels:
    istio.io/use-waypoint: payment-waypoint # Targets Ambient L7 Waypoint
spec:
  parentRefs:
    - group: ""
      kind: Service
      name: payment-service
      port: 8080
  rules:
    - backendRefs:
        - group: ""
          kind: Service
          name: payment-service-local
          port: 8080
          weight: 100
        - group: multicluster.x-k8s.io
          kind: ServiceImport
          name: payment-service-dr-region
          port: 8080
          weight: 0 # Activated dynamically when local cluster triggers outlier ejection
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: payment-ambient-circuit-breaker
  namespace: production
spec:
  host: payment-service.production.svc.cluster.local
  trafficPolicy:
    connectionPool:
      tcp:
        maxConnections: 1024
      http:
        http1MaxPendingRequests: 100
        maxRequestsPerConnection: 10
    outlierDetection:
      consecutive5xxErrors: 3
      interval: 5s
      baseEjectionTime: 30s
      maxEjectionPercent: 100
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: GAMMA Ambient Multi-Cluster Failover & L7 Outlier Circuit Breaking Standard

GAMMA Ambient Multi-Cluster Failover & L7 Outlier Circuit Breaking Standard defines an industrial-grade behavioral standard for devops engineering. Enforces strict declarative L7 east-west traffic failover and real-time outlier detection across multi-cluster service meshes using Kubernetes Gateway API GAMMA specifications and sidecarless ambient waypoints. Eliminates split-brain outages and client DNS caching bottlenecks by replacing DNS TTL-based shifting with kernel/waypoint-level active-passive circuit breaking. 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: Relying on Client-Side DNS Resolution and Legacy Sidecars for Regional East-West Failover 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 DriftRelying on Client-Side DNS Resolution and Legacy Sidecars for Regional East-West FailoverCritical
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 attach GAMMA-compliant HTTPRoute resources directly to the target Service as a parentRef, declaring local and cross-cluster ServiceImport destinations under backendRefs.

Engineers MUST ALWAYS attach GAMMA-compliant HTTPRoute resources directly to the target Service as a parentRef, declaring local and cross-cluster ServiceImport destinations under backendRefs.

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 NOT rely on DNS failover, ExternalName services, or global load balancer DNS TTL manipulation for east-west cross-cluster service communication.

Engineers MUST NOT rely on DNS failover, ExternalName services, or global load balancer DNS TTL manipulation for east-west cross-cluster service communication.

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 configure declarative outlier detection and circuit breaking at the ambient waypoint or gateway level with explicit consecutiveGatewayErrors, interval, and baseEjectionTime.

Engineers MUST configure declarative outlier detection and circuit breaking at the ambient waypoint or gateway level with explicit consecutiveGatewayErrors, interval, and baseEjectionTime.

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

Engineers MUST deploy dedicated waypoint proxies (ambient architecture) using 'istio.io/use-waypoint' or equivalent mesh gateway annotations rather than injecting L7 sidecars into workload pods.

Engineers MUST deploy dedicated waypoint proxies (ambient architecture) using 'istio.io/use-waypoint' or equivalent mesh gateway annotations rather than injecting L7 sidecars into workload pods.

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

Multi-cluster failover routes MUST configure cross-region fallback endpoints with a zero-initial-weight active-passive policy or an automated outlier-triggered failover priority rule.

Multi-cluster failover routes MUST configure cross-region fallback endpoints with a zero-initial-weight active-passive policy or an automated outlier-triggered failover priority rule.

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.
6

Connection pool settings MUST enforce maxConnections, maxPendingRequests, and maxRequestsPerConnection limits to prevent cascading failure across cluster boundaries during regional degradation.

Connection pool settings MUST enforce maxConnections, maxPendingRequests, and maxRequestsPerConnection limits to prevent cascading failure across cluster boundaries during regional degradation.

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.
7

Mesh infrastructure components NEVER bypass mutual TLS (mTLS) in transit across cluster boundaries

Mesh infrastructure components NEVER bypass mutual TLS (mTLS) in transit across cluster boundaries; cross-cluster egress MUST traverse verified waypoint tunnel encapsulation.

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 GAMMA Ambient Multi-Cluster Failover & L7 Outlier Circuit Breaking Standard critical for AI coding assistants?

Enforces strict declarative L7 east-west traffic failover and real-time outlier detection across multi-cluster service meshes using Kubernetes Gateway API GAMMA specifications and sidecarless ambient waypoints. Eliminates split-brain outages and client DNS caching bottlenecks by replacing DNS TTL-based shifting with kernel/waypoint-level active-passive circuit breaking. 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 (Relying on Client-Side DNS Resolution and Legacy Sidecars for Regional East-West Failover) 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

GAMMA