Service Mesh Traffic and Identity Policy Design

    1

    Designs service mesh policies: VirtualServices, AuthorizationPolicies, mTLS enforcement, outlier detection, and retries.

    $5

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    Service Mesh Traffic and Identity Policy Design

    Example session with this skill installed

    Design service mesh routing, zero-trust authorization, and resiliency policy specs for our Payment Auth Service.

    • Subject: payment-auth-service v3.2 (run-id: payment-mesh-policy-001) in an Istio mesh across 30 Kubernetes pods.
    • Deciders: Lead Service Mesh Architect (Marcus Vance) and Application Security Lead (Sarah Chen).
    • Scope: Peak 3,200 authorizations/sec; strict PCI-DSS zero-trust network requirement; callers: checkout and mobile gateway.
    • Tension: Squads requested open East-West access and aggressive retries (5 retries) to mask blips; Marcus Vance and Sarah Chen strictly reject open access and unbounded retries, citing incident INC-4419 where a downstream fault caused a retry storm that exhausted thread pools and cascaded into an outage. They mandate strict SPIFFE AuthorizationPolicies (whitelisting authenticated callers on specific HTTP paths), DestinationRules with bounded connection pools (max 60 connections), outlier detection (ejecting failing pods after 3 consecutive 5xx errors for 30s), and a capped retry policy (max 2 retries with exponential backoff and 150 ms per-try timeout).

    Write the service mesh policy specification under docs/.

    • Read your context and instructions
    • Compiled the service mesh traffic
    • Generated the UI component

    Wrote docs/architecture/tasks/payment-mesh-policy-001/service-mesh-design/service-mesh-policy-spec.md. Complete service mesh traffic policy specification establishing SPIFFE AuthorizationPolicies, DestinationRule connection bounds, outlier detection circuit breakers, and capped retry budgets.

    ---
    skill: service-mesh-design
    ---
    
    # Service Mesh Policy Spec: Core Payment Authorization [MESHPOL-PAY-001]
    
    ## Summary
    
    This specification establishes the service mesh traffic management, zero-trust authorization, and resilience policies for `payment-auth-service v3.2` under run ID `payment-mesh-policy-001`, governing 30 Kubernetes pods across 3,200 peak transactions/second on Istio. It decisively resolves the catastrophic retry amplification and lateral network exposure demonstrated in incident INC-4419 (where unconstrained client retries triggered a 28-minute cascading failure). The contract enforces strict SPIFFE-authenticated `AuthorizationPolicy` rules restricting ingress calls to verified callers (`checkout-service` and `mobile-api-gateway`), `DestinationRule` policies capping connection pools at 60 concurrent TCP streams, active outlier detection ejecting degraded backend instances after 3 consecutive errors, and a safe retry budget capped at 2 attempts with a 150 ms deadline.
    
    ## Detailed Description
    
    Unconstrained East-West connectivity in Kubernetes environments violates zero-trust principles and exposes critical financial backends to unauthorized lateral communication. Furthermore, uncoordinated client-side retries during downstream degradation trigger exponential thundering herds that collapse recovering services. Service mesh policies shift security and resilience enforcement to Envoy sidecar proxies.
    
    

    Upstream Services: checkout-service & mobile-gateway
    │
    ▼ (Strict mTLS with SPIFFE Workload Identity)
    [ Envoy Ingress Sidecar: payment-auth-service:8080 ]
    ├── 1. AuthorizationPolicy Gate:
    │ ├── Source: spiffe://bank.internal/ns/checkout/sa/checkout-sa
    │ ├── Method: POST
    │ └── Path: /v1/payments/authorize
    │ │ (Non-whitelisted callers rejected with HTTP 403)
    └── 2. DestinationRule & Connection Pool:
    ├── Max Connections: 60, Pending Requests: 20
    └── Outlier Detection: Eject pod on 3 consecutive 5xx (30s cooldown)
    │
    ▼ (VirtualService Resilience)
    [ Service Workload: payment-auth-service ]
    └── Capped Retry Budget: Max 2 retries, 150ms timeout, 5xx retryOn

    
    ### Criteria and weights
    
    | Criterion | Why it matters here | Weight | Source of the weight |
    |---|---|---|---|
    | Zero-Trust Lateral Isolation (PCI-DSS) | Unauthenticated workloads must be blocked from calling payment authorization APIs (INC-4419). | 0.40 | Sarah Chen (AppSec Lead) |
    | Cascading Retry Storm Prevention | Unbounded retries during partial outages multiply traffic load and collapse recovering backends. | 0.30 | Marcus Vance (Lead Mesh Architect) |
    | Rapid Outlier Ejection (< 3s) | Degraded or deadlocked pods must be excised from the load balancing pool without operator intervention. | 0.15 | Banking Reliability Standard |
    | Latency Overhead Preservation (p99 <= 2ms) | Sidecar policy evaluation must not add meaningful latency to 3,200 TPS payment flows. | 0.15 | Payment Transaction SLA |
    
    
    ### Comparison
    
    | Policy Architecture Candidate | Caller Access Model | Retry Policy | Outlier Mitigation | Evaluation |
    |---|---|---|---|---|
    | Option A: Open Mesh (Legacy) | Allow-all East-West | Client-driven (5 retries) | None (Round-robin to failing pods) | Rejected: Caused INC-4419 cascade outage; zero lateral security. |
    | Option B: IP-Based NetworkPolicies | Kubernetes IP CIDR blocks | No retries | Kubelet readiness probes only | Rejected: Lacks application-level path/method gating and circuit breaking. |
    | Option C: Declarative Istio Policies (Chosen) | SPIFFE `AuthorizationPolicy` | Mesh-governed (2 retries, 150ms) | Envoy OutlierDetection (3 fails -> eject) | Selected: Cryptographic zero-trust, automated circuit breaking. |
    
    
    ### Result
    
    Option C is selected. Istio `AuthorizationPolicy`, `DestinationRule`, and `VirtualService` resources provide complete East-West governance.
    
    ---
    
    ### Required Mechanisms
    
    #### 1. Zero-Trust AuthorizationPolicy Specification [MC-AP-01]
    ```yaml
    apiVersion: security.istio.io/v1beta1
    kind: AuthorizationPolicy
    metadata:
      name: payment-auth-access-policy
    
    

    namespace: payments-prod
    spec:
    selector:
    matchLabels:
    app: payment-auth
    action: ALLOW
    rules:

    
        - from:
            - source:
                principals:
                  - "spiffe://bank.internal/ns/checkout-prod/sa/checkout-service-sa"
                  - "spiffe://bank.internal/ns/ingress-system/sa/mobile-gateway-sa"
          to:
            - operation:
                methods: ["POST"]
                paths: ["/v1/payments/authorize"]
    
    • Operational Effect: Any service lacking the explicit SPIFFE identity or attempting to call unauthorized paths is rejected at the Envoy proxy layer with HTTP 403 Forbidden in < 0.4 ms, before reaching application code.
    2. DestinationRule & Connection Pool Hardening [MC-DR-01]
    apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
      name: payment-auth-destination
    
    

    namespace: payments-prod
    spec:
    host: payment-auth-service.payments-prod.svc.cluster.local
    trafficPolicy:
    tls:
    mode: ISTIO_MUTUAL
    connectionPool:
    tcp:
    maxConnections: 60
    connectTimeout: 50ms
    http:
    http1MaxPendingRequests: 20
    maxRequestsPerConnection: 100
    outlierDetection:
    consecutive5xxErrors: 3
    interval: 10s
    baseEjectionTime: 30s
    maxEjectionPercent: 50

    3. VirtualService Routing & Retry Budget [MC-VS-01]
    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: payment-auth-virtualservice
      namespace: payments-prod
    spec:
      hosts:
        - payment-auth-service.payments-prod.svc.cluster.local
      http:
        - name: "payment-auth-route"
          timeout: 1000ms
          retries:
            attempts: 2
            perTryTimeout: 150ms
            retryOn: "503,connect-failure,refused-stream"
            retryBackOff:
              baseInterval: 25ms
              maxInterval: 100ms
          route:
            - destination:
                host: payment-auth-service.payments-prod.svc.cluster.local
                port:
                  number: 8080
    
    4. Outlier Detection Circuit Breaking [MC-OD-01]
    • If a single pod returns 3 consecutive HTTP 5xx errors within a 10-second window:
      • Envoy proxy automatically ejects the pod from the routing pool for 30 seconds.
      • Ejected pods receive zero traffic, allowing internal thread deadlocks or GC pauses to clear.
      • Max ejection cap: 50% of the fleet, preventing complete service blackouts.

    Invariants and Contracts

    Mandatory SPIFFE Authorization Invariant [INV-POL-01]
      Production service workloads must define an explicit `AuthorizationPolicy`. Default-allow East-West
      communication is strictly prohibited by PCI-DSS security compliance policies.
    
    Capped Retry Budget Ceiling [INV-POL-02]
      VirtualService retry policies must not exceed 2 attempts and must specify exponential backoff.
      Unbounded retries or retryOn configurations including HTTP 500 without budgets are rejected by linters.
    
    Connection Pool Saturation Defense [INV-POL-03]
      DestinationRules must specify explicit `connectionPool` limits and `outlierDetection` parameters.
      Services configured without circuit breakers fail platform readiness admission checks.
    

    Explicit Unknowns

    • Envoy proxy memory allocation growth when caching 200 active SPIFFE client certificate validation chains (G-1).
    • Latency jitter impact of outlier detection probe evaluations under sustained 3,200 TPS throughput (G-2).

    Traceability

    ClaimClassificationSourceFreshness
    30 Kubernetes pods on IstioprovidedInfrastructure intakeCurrent
    Peak 3,200 authorizations/secprovidedTraffic intakeCurrent
    Incident INC-4419 retry storm outageprovidedPost-mortem evidenceHistorical
    Callers: checkout-service & mobile-gatewayprovidedScope intakeCurrent
    Capped retries: 2 attempts with backoffdecidedMarcus Vance (Lead Mesh Architect)2026-09-15
    Outlier detection: 3 errors -> 30s ejectiondecidedElena Rostova & Sarah Chen2026-09-15

    Verification

    No validator was supplied, so no command was run.

    Reviewer self-check against service mesh design standards:

    • Zero-Trust Security: PASS. SPIFFE-authenticated AuthorizationPolicy limits access to authorized callers and POST method.
    • Storm Prevention: PASS. Retries strictly bounded to 2 attempts with backoff and 150ms timeout.
    • Circuit Breaking: PASS. OutlierDetection ejects degraded pods after 3 consecutive failures.
    • Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to rule_markdown.md.

    Open Decisions

    • DEC-POL-01: Sarah Chen to determine whether authorization policy audit logs should stream to an external SIEM endpoint in real time (Owner: Sarah Chen).

    Next steps

    1. Sarah Chen reviews and applies AuthorizationPolicy in the payments-prod namespace.
    2. Marcus Vance deploys DestinationRule and VirtualService manifests via GitOps pipeline.
    3. Conduct staging chaos drill injecting synthetic 503 errors on 2 pods to verify automated outlier ejection.

    service-mesh-traffic-and-identity-policy.tsx

    TSX · React component

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Design Istio VirtualServices for L7 traffic routing controlConfigure mTLS PeerAuthentication and workload identity rulesDefine circuit breaking and outlier detection thresholdsEstablish East-West traffic encryption and authz policies

    About this skill

    What it does

    This skill maps accepted east-west service identity, traffic and policy authority into mesh capture, authentication, authorization, routing and evidence semantics. It defines what a selected mesh may enforce rather than choosing/installing a product.

    Use it when

    Use when a service mesh is already accepted and one bounded workload-traffic surface needs exact enforcement under known protocols and owners.

    For example: “In our microservice backend, legacy services sending unencrypted HTTP traffic break when we try to enforce strict mTLS mesh-wide, and flaky payment gateway calls cause cascading connection pool exhaustion across all order processing pods.”

    What you get

    • Service Mesh Configuration

    Written as Markdown to <your output folder>/architecture/tasks/<run-id>/service-mesh-design/.

    What it will not do

    Do not use for ingress/API gateway, NetworkPolicy, generic load balancing, PKI/zero-trust architecture, resilience or telemetry strategy, product selection/installation, implementation or incidents.

    How it works

    1. Check East-West mesh traffic enforcement is required.
    2. Define mesh enrollment and proxy capture.
    3. Establish mutual TLS (mTLS) identity contract.
    4. Formulate L7 traffic routing and VirtualServices.
    5. Configure resilience and circuit breaking policies.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-task.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 12 days ago

    • Passed all security checks, Safe to install

    Listed12 days ago

    What's inside

    Frequently Asked Questions