Implement Linkerd service mesh patterns for lightweight

Linkerd patterns

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Linkerd patterns cover

Implement Linkerd service mesh patterns for lightweight, security-focused service mesh deployments. Use when setting up Linkerd, configuring traffic policies, or implementing zero-trust networking with minimal overhead.

---
name: linkerd-patterns
description: Implement Linkerd service mesh patterns for lightweight, security-focused service mesh deployments. Use when setting up Linkerd, configuring traffic policies, or implementing zero-trust networking with minimal overhead.
---

# Linkerd Patterns

Production patterns for Linkerd service mesh - the lightweight, security-first service mesh for Kubernetes.

## When to Use This Skill

- Setting up a lightweight service mesh
- Implementing automatic mTLS
- Configuring traffic splits for canary deployments
- Setting up service profiles for per-route metrics
- Implementing retries and timeouts
- Multi-cluster service mesh

Overview

Production patterns for Linkerd service mesh - the lightweight, security-first service mesh for Kubernetes.

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill linkerd-patterns -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/cloud-infrastructure/skills/linkerd-patterns
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/af26a863c70759728200/linkerd-patterns.zip" -OutFile "$env:TEMP\linkerd-patterns.zip"; Expand-Archive "$env:TEMP\linkerd-patterns.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md7.7 KB
Read the files here
wshobson/4236bb91 file
SKILL.md
Show the full text306 lines

Linkerd Patterns

Production patterns for Linkerd service mesh - the lightweight, security-first service mesh for Kubernetes.

When to Use This Skill

  • Setting up a lightweight service mesh
  • Implementing automatic mTLS
  • Configuring traffic splits for canary deployments
  • Setting up service profiles for per-route metrics
  • Implementing retries and timeouts
  • Multi-cluster service mesh

Core Concepts

1. Linkerd Architecture
┌─────────────────────────────────────────────┐
│                Control Plane                 │
│  ┌─────────┐ ┌──────────┐ ┌──────────────┐ │
│  │ destiny │ │ identity │ │ proxy-inject │ │
│  └─────────┘ └──────────┘ └──────────────┘ │
└─────────────────────────────────────────────┘
                      │
┌─────────────────────────────────────────────┐
│                 Data Plane                   │
│  ┌─────┐    ┌─────┐    ┌─────┐             │
│  │proxy│────│proxy│────│proxy│             │
│  └─────┘    └─────┘    └─────┘             │
│     │           │           │               │
│  ┌──┴──┐    ┌──┴──┐    ┌──┴──┐            │
│  │ app │    │ app │    │ app │            │
│  └─────┘    └─────┘    └─────┘            │
└─────────────────────────────────────────────┘
2. Key Resources
Resource Purpose
ServiceProfile Per-route metrics, retries, timeouts
TrafficSplit Canary deployments, A/B testing
Server Define server-side policies
ServerAuthorization Access control policies

Templates

Template 1: Mesh Installation
# Install CLI
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh

# Validate cluster
linkerd check --pre

# Install CRDs
linkerd install --crds | kubectl apply -f -

# Install control plane
linkerd install | kubectl apply -f -

# Verify installation
linkerd check

# Install viz extension (optional)
linkerd viz install | kubectl apply -f -
Template 2: Inject Namespace
# Automatic injection for namespace
apiVersion: v1
kind: Namespace
metadata:
  name: my-app
  annotations:
    linkerd.io/inject: enabled
---
# Or inject specific deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  annotations:
    linkerd.io/inject: enabled
spec:
  template:
    metadata:
      annotations:
        linkerd.io/inject: enabled
Template 3: Service Profile with Retries
apiVersion: linkerd.io/v1alpha2
kind: ServiceProfile
metadata:
  name: my-service.my-namespace.svc.cluster.local
  namespace: my-namespace
spec:
  routes:
    - name: GET /api/users
      condition:
        method: GET
        pathRegex: /api/users
      responseClasses:
        - condition:
            status:
              min: 500
              max: 599
          isFailure: true
      isRetryable: true
    - name: POST /api/users
      condition:
        method: POST
        pathRegex: /api/users
      # POST not retryable by default
      isRetryable: false
    - name: GET /api/users/{id}
      condition:
        method: GET
        pathRegex: /api/users/[^/]+
      timeout: 5s
      isRetryable: true
  retryBudget:
    retryRatio: 0.2
    minRetriesPerSecond: 10
    ttl: 10s
Template 4: Traffic Split (Canary)
apiVersion: split.smi-spec.io/v1alpha1
kind: TrafficSplit
metadata:
  name: my-service-canary
  namespace: my-namespace
spec:
  service: my-service
  backends:
    - service: my-service-stable
      weight: 900m # 90%
    - service: my-service-canary
      weight: 100m # 10%
Template 5: Server Authorization Policy
# Define the server
apiVersion: policy.linkerd.io/v1beta1
kind: Server
metadata:
  name: my-service-http
  namespace: my-namespace
spec:
  podSelector:
    matchLabels:
      app: my-service
  port: http
  proxyProtocol: HTTP/1
---
# Allow traffic from specific clients
apiVersion: policy.linkerd.io/v1beta1
kind: ServerAuthorization
metadata:
  name: allow-frontend
  namespace: my-namespace
spec:
  server:
    name: my-service-http
  client:
    meshTLS:
      serviceAccounts:
        - name: frontend
          namespace: my-namespace
---
# Allow unauthenticated traffic (e.g., from ingress)
apiVersion: policy.linkerd.io/v1beta1
kind: ServerAuthorization
metadata:
  name: allow-ingress
  namespace: my-namespace
spec:
  server:
    name: my-service-http
  client:
    unauthenticated: true
    networks:
      - cidr: 10.0.0.0/8
Template 6: HTTPRoute for Advanced Routing
apiVersion: policy.linkerd.io/v1beta2
kind: HTTPRoute
metadata:
  name: my-route
  namespace: my-namespace
spec:
  parentRefs:
    - name: my-service
      kind: Service
      group: core
      port: 8080
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /api/v2
        - headers:
            - name: x-api-version
              value: v2
      backendRefs:
        - name: my-service-v2
          port: 8080
    - matches:
        - path:
            type: PathPrefix
            value: /api
      backendRefs:
        - name: my-service-v1
          port: 8080
Template 7: Multi-cluster Setup
# On each cluster, install with cluster credentials
linkerd multicluster install | kubectl apply -f -

# Link clusters
linkerd multicluster link --cluster-name west \
  --api-server-address https://west.example.com:6443 \
  | kubectl apply -f -

# Export a service to other clusters
kubectl label svc/my-service mirror.linkerd.io/exported=true

# Verify cross-cluster connectivity
linkerd multicluster check
linkerd multicluster gateways

Monitoring Commands

# Live traffic view
linkerd viz top deploy/my-app

# Per-route metrics
linkerd viz routes deploy/my-app

# Check proxy status
linkerd viz stat deploy -n my-namespace

# View service dependencies
linkerd viz edges deploy -n my-namespace

# Dashboard
linkerd viz dashboard

Debugging

# Check injection status
linkerd check --proxy -n my-namespace

# View proxy logs
kubectl logs deploy/my-app -c linkerd-proxy

# Debug identity/TLS
linkerd identity -n my-namespace

# Tap traffic (live)
linkerd viz tap deploy/my-app --to deploy/my-backend

Best Practices

Do's
  • Enable mTLS everywhere - It's automatic with Linkerd
  • Use ServiceProfiles - Get per-route metrics and retries
  • Set retry budgets - Prevent retry storms
  • Monitor golden metrics - Success rate, latency, throughput
Don'ts
  • Don't skip check - Always run linkerd check after changes
  • Don't over-configure - Linkerd defaults are sensible
  • Don't ignore ServiceProfiles - They unlock advanced features
  • Don't forget timeouts - Set appropriate values per route
1---
2name: linkerd-patterns
3description: Implement Linkerd service mesh patterns for lightweight, security-focused service mesh deployments. Use when setting up Linkerd, configuring traffic policies, or implementing zero-trust networking with minimal overhead.
4---
5 
6# Linkerd Patterns
7 
8Production patterns for Linkerd service mesh - the lightweight, security-first service mesh for Kubernetes.
9 
10## When to Use This Skill
11 
12- Setting up a lightweight service mesh
13- Implementing automatic mTLS
14- Configuring traffic splits for canary deployments
15- Setting up service profiles for per-route metrics
16- Implementing retries and timeouts
17- Multi-cluster service mesh
18 
19## Core Concepts
20 
21### 1. Linkerd Architecture
22 
23```
24┌─────────────────────────────────────────────┐
25│ Control Plane │
26│ ┌─────────┐ ┌──────────┐ ┌──────────────┐ │
27│ │ destiny │ │ identity │ │ proxy-inject │ │
28│ └─────────┘ └──────────┘ └──────────────┘ │
29└─────────────────────────────────────────────┘
30 │
31┌─────────────────────────────────────────────┐
32│ Data Plane │
33│ ┌─────┐ ┌─────┐ ┌─────┐ │
34│ │proxy│────│proxy│────│proxy│ │
35│ └─────┘ └─────┘ └─────┘ │
36│ │ │ │ │
37│ ┌──┴──┐ ┌──┴──┐ ┌──┴──┐ │
38│ │ app │ │ app │ │ app │ │
39│ └─────┘ └─────┘ └─────┘ │
40└─────────────────────────────────────────────┘
41```
42 
43### 2. Key Resources
44 
45| Resource | Purpose |
46| ----------------------- | ------------------------------------ |
47| **ServiceProfile** | Per-route metrics, retries, timeouts |
48| **TrafficSplit** | Canary deployments, A/B testing |
49| **Server** | Define server-side policies |
50| **ServerAuthorization** | Access control policies |
51 
52## Templates
53 
54### Template 1: Mesh Installation
55 
56```bash
57# Install CLI
58curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh
59 
60# Validate cluster
61linkerd check --pre
62 
63# Install CRDs
64linkerd install --crds | kubectl apply -f -
65 
66# Install control plane
67linkerd install | kubectl apply -f -
68 
69# Verify installation
70linkerd check
71 
72# Install viz extension (optional)
73linkerd viz install | kubectl apply -f -
74```
75 
76### Template 2: Inject Namespace
77 
78```yaml
79# Automatic injection for namespace
80apiVersion: v1
81kind: Namespace
82metadata:
83 name: my-app
84 annotations:
85 linkerd.io/inject: enabled
86---
87# Or inject specific deployment
88apiVersion: apps/v1
89kind: Deployment
90metadata:
91 name: my-app
92 annotations:
93 linkerd.io/inject: enabled
94spec:
95 template:
96 metadata:
97 annotations:
98 linkerd.io/inject: enabled
99```
100 
101### Template 3: Service Profile with Retries
102 
103```yaml
104apiVersion: linkerd.io/v1alpha2
105kind: ServiceProfile
106metadata:
107 name: my-service.my-namespace.svc.cluster.local
108 namespace: my-namespace
109spec:
110 routes:
111 - name: GET /api/users
112 condition:
113 method: GET
114 pathRegex: /api/users
115 responseClasses:
116 - condition:
117 status:
118 min: 500
119 max: 599
120 isFailure: true
121 isRetryable: true
122 - name: POST /api/users
123 condition:
124 method: POST
125 pathRegex: /api/users
126 # POST not retryable by default
127 isRetryable: false
128 - name: GET /api/users/{id}
129 condition:
130 method: GET
131 pathRegex: /api/users/[^/]+
132 timeout: 5s
133 isRetryable: true
134 retryBudget:
135 retryRatio: 0.2
136 minRetriesPerSecond: 10
137 ttl: 10s
138```
139 
140### Template 4: Traffic Split (Canary)
141 
142```yaml
143apiVersion: split.smi-spec.io/v1alpha1
144kind: TrafficSplit
145metadata:
146 name: my-service-canary
147 namespace: my-namespace
148spec:
149 service: my-service
150 backends:
151 - service: my-service-stable
152 weight: 900m # 90%
153 - service: my-service-canary
154 weight: 100m # 10%
155```
156 
157### Template 5: Server Authorization Policy
158 
159```yaml
160# Define the server
161apiVersion: policy.linkerd.io/v1beta1
162kind: Server
163metadata:
164 name: my-service-http
165 namespace: my-namespace
166spec:
167 podSelector:
168 matchLabels:
169 app: my-service
170 port: http
171 proxyProtocol: HTTP/1
172---
173# Allow traffic from specific clients
174apiVersion: policy.linkerd.io/v1beta1
175kind: ServerAuthorization
176metadata:
177 name: allow-frontend
178 namespace: my-namespace
179spec:
180 server:
181 name: my-service-http
182 client:
183 meshTLS:
184 serviceAccounts:
185 - name: frontend
186 namespace: my-namespace
187---
188# Allow unauthenticated traffic (e.g., from ingress)
189apiVersion: policy.linkerd.io/v1beta1
190kind: ServerAuthorization
191metadata:
192 name: allow-ingress
193 namespace: my-namespace
194spec:
195 server:
196 name: my-service-http
197 client:
198 unauthenticated: true
199 networks:
200 - cidr: 10.0.0.0/8
201```
202 
203### Template 6: HTTPRoute for Advanced Routing
204 
205```yaml
206apiVersion: policy.linkerd.io/v1beta2
207kind: HTTPRoute
208metadata:
209 name: my-route
210 namespace: my-namespace
211spec:
212 parentRefs:
213 - name: my-service
214 kind: Service
215 group: core
216 port: 8080
217 rules:
218 - matches:
219 - path:
220 type: PathPrefix
221 value: /api/v2
222 - headers:
223 - name: x-api-version
224 value: v2
225 backendRefs:
226 - name: my-service-v2
227 port: 8080
228 - matches:
229 - path:
230 type: PathPrefix
231 value: /api
232 backendRefs:
233 - name: my-service-v1
234 port: 8080
235```
236 
237### Template 7: Multi-cluster Setup
238 
239```bash
240# On each cluster, install with cluster credentials
241linkerd multicluster install | kubectl apply -f -
242 
243# Link clusters
244linkerd multicluster link --cluster-name west \
245 --api-server-address https://west.example.com:6443 \
246 | kubectl apply -f -
247 
248# Export a service to other clusters
249kubectl label svc/my-service mirror.linkerd.io/exported=true
250 
251# Verify cross-cluster connectivity
252linkerd multicluster check
253linkerd multicluster gateways
254```
255 
256## Monitoring Commands
257 
258```bash
259# Live traffic view
260linkerd viz top deploy/my-app
261 
262# Per-route metrics
263linkerd viz routes deploy/my-app
264 
265# Check proxy status
266linkerd viz stat deploy -n my-namespace
267 
268# View service dependencies
269linkerd viz edges deploy -n my-namespace
270 
271# Dashboard
272linkerd viz dashboard
273```
274 
275## Debugging
276 
277```bash
278# Check injection status
279linkerd check --proxy -n my-namespace
280 
281# View proxy logs
282kubectl logs deploy/my-app -c linkerd-proxy
283 
284# Debug identity/TLS
285linkerd identity -n my-namespace
286 
287# Tap traffic (live)
288linkerd viz tap deploy/my-app --to deploy/my-backend
289```
290 
291## Best Practices
292 
293### Do's
294 
295- **Enable mTLS everywhere** - It's automatic with Linkerd
296- **Use ServiceProfiles** - Get per-route metrics and retries
297- **Set retry budgets** - Prevent retry storms
298- **Monitor golden metrics** - Success rate, latency, throughput
299 
300### Don'ts
301 
302- **Don't skip check** - Always run `linkerd check` after changes
303- **Don't over-configure** - Linkerd defaults are sensible
304- **Don't ignore ServiceProfiles** - They unlock advanced features
305- **Don't forget timeouts** - Set appropriate values per route
306 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
SkillGuides stable API and interface designaddyosmani/agent-skills · by addyosmaniGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.★ 98.7k GitHub starsMCPPulls up-to-date, version-specific library docsContext7upstash/context7 · by upstashPulls up-to-date, version-specific library docs and code examples into the prompt so the AI stops inventing old APIs.★ 62.3k GitHub starsSkillFetch up-to-date documentation and code examples for anyContext7 Documentation Lookupupstash/context7 · by upstashFetch up-to-date documentation and code examples for any library, framework, SDK, CLI tool, or cloud service. Use whenever the user asks about a specific library — even well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot — because training data may not reflect recent API changes or version updates. Always use for: API syntax questions, configuration options, version migration issues, "how do I" questions mentioning a library name, debugging that involves library-specific behavior, setup instructions, and CLI tool usage. Use even when you think you know the answer. Do not rely on training data for API details, signatures, or configuration options — they are frequently out of date. Prefer this over web search for library documentation.★ 62.3k GitHub starsSkillHow to use the Adaptyv Bio Foundry API and Python SDKK-Dense-AI/scientific-agent-skills · by K-Dense-AIHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.★ 46k GitHub starsSkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillGuides the usage of Gemini Interactions API on GeminiGemini Interactions API Skillgoogle/skills · by googleGuides the usage of Gemini Interactions API on Gemini Enterprise Agent Platform. Use when the user wants to use the stateful, server-managed Interactions API for multi-turn conversations, background execution, streaming, structured output, and function calling on the Agent Platform.★ 20.9k GitHub stars

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillMigrate from AngularJS to Angular using hybrid modeAngular migrationwshobson/agents · by wshobsonMigrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub stars