Implement Linkerd service mesh patterns for lightweight
Linkerd patterns

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 Code
npx skills add wshobson/agents --skill linkerd-patterns -g -a claude-codeClaude 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-patternsWindows (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" -ForceClaude.ai / desktop
Codex, Cursor, other agents
Connects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md7.7 KB
Read the files here
wshobson/
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 checkafter 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 | |
| 2 | name linkerd-patterns |
| 3 | 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. |
| 4 | |
| 5 | |
| 6 | # Linkerd Patterns |
| 7 | |
| 8 | Production 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 | |
| 57 | # Install CLI |
| 58 | curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh |
| 59 | |
| 60 | # Validate cluster |
| 61 | linkerd check --pre |
| 62 | |
| 63 | # Install CRDs |
| 64 | linkerd install --crds | kubectl apply -f - |
| 65 | |
| 66 | # Install control plane |
| 67 | linkerd install | kubectl apply -f - |
| 68 | |
| 69 | # Verify installation |
| 70 | linkerd check |
| 71 | |
| 72 | # Install viz extension (optional) |
| 73 | linkerd viz install | kubectl apply -f - |
| 74 | |
| 75 | |
| 76 | ### Template 2: Inject Namespace |
| 77 | |
| 78 | |
| 79 | # Automatic injection for namespace |
| 80 | apiVersion: v1 |
| 81 | kind: Namespace |
| 82 | metadata: |
| 83 | name: my-app |
| 84 | annotations: |
| 85 | linkerd.io/inject: enabled |
| 86 | |
| 87 | # Or inject specific deployment |
| 88 | apiVersion: apps/v1 |
| 89 | kind: Deployment |
| 90 | metadata: |
| 91 | name: my-app |
| 92 | annotations: |
| 93 | linkerd.io/inject: enabled |
| 94 | spec: |
| 95 | template: |
| 96 | metadata: |
| 97 | annotations: |
| 98 | linkerd.io/inject: enabled |
| 99 | |
| 100 | |
| 101 | ### Template 3: Service Profile with Retries |
| 102 | |
| 103 | |
| 104 | apiVersion: linkerd.io/v1alpha2 |
| 105 | kind: ServiceProfile |
| 106 | metadata: |
| 107 | name: my-service.my-namespace.svc.cluster.local |
| 108 | namespace: my-namespace |
| 109 | spec: |
| 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 | |
| 143 | apiVersion: split.smi-spec.io/v1alpha1 |
| 144 | kind: TrafficSplit |
| 145 | metadata: |
| 146 | name: my-service-canary |
| 147 | namespace: my-namespace |
| 148 | spec: |
| 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 | |
| 160 | # Define the server |
| 161 | apiVersion: policy.linkerd.io/v1beta1 |
| 162 | kind: Server |
| 163 | metadata: |
| 164 | name: my-service-http |
| 165 | namespace: my-namespace |
| 166 | spec: |
| 167 | podSelector: |
| 168 | matchLabels: |
| 169 | app: my-service |
| 170 | port: http |
| 171 | proxyProtocol: HTTP/1 |
| 172 | |
| 173 | # Allow traffic from specific clients |
| 174 | apiVersion: policy.linkerd.io/v1beta1 |
| 175 | kind: ServerAuthorization |
| 176 | metadata: |
| 177 | name: allow-frontend |
| 178 | namespace: my-namespace |
| 179 | spec: |
| 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) |
| 189 | apiVersion: policy.linkerd.io/v1beta1 |
| 190 | kind: ServerAuthorization |
| 191 | metadata: |
| 192 | name: allow-ingress |
| 193 | namespace: my-namespace |
| 194 | spec: |
| 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 | |
| 206 | apiVersion: policy.linkerd.io/v1beta2 |
| 207 | kind: HTTPRoute |
| 208 | metadata: |
| 209 | name: my-route |
| 210 | namespace: my-namespace |
| 211 | spec: |
| 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 | |
| 240 | # On each cluster, install with cluster credentials |
| 241 | linkerd multicluster install | kubectl apply -f - |
| 242 | |
| 243 | # Link clusters |
| 244 | linkerd 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 |
| 249 | kubectl label svc/my-service mirror.linkerd.io/exported=true |
| 250 | |
| 251 | # Verify cross-cluster connectivity |
| 252 | linkerd multicluster check |
| 253 | linkerd multicluster gateways |
| 254 | |
| 255 | |
| 256 | ## Monitoring Commands |
| 257 | |
| 258 | |
| 259 | # Live traffic view |
| 260 | linkerd viz top deploy/my-app |
| 261 | |
| 262 | # Per-route metrics |
| 263 | linkerd viz routes deploy/my-app |
| 264 | |
| 265 | # Check proxy status |
| 266 | linkerd viz stat deploy -n my-namespace |
| 267 | |
| 268 | # View service dependencies |
| 269 | linkerd viz edges deploy -n my-namespace |
| 270 | |
| 271 | # Dashboard |
| 272 | linkerd viz dashboard |
| 273 | |
| 274 | |
| 275 | ## Debugging |
| 276 | |
| 277 | |
| 278 | # Check injection status |
| 279 | linkerd check --proxy -n my-namespace |
| 280 | |
| 281 | # View proxy logs |
| 282 | kubectl logs deploy/my-app -c linkerd-proxy |
| 283 | |
| 284 | # Debug identity/TLS |
| 285 | linkerd identity -n my-namespace |
| 286 | |
| 287 | # Tap traffic (live) |
| 288 | linkerd 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 |
Details
- Updated
- Sep 21, 2026
- License
- MIT
- Stars on the repo
- ★ 39,857
- Checked
- Source
- wshobson/agents ↗
- Creator
- wshobson · 179 listings
Similar skills
See all →
SkillGuides stable API and interface design
MCPPulls up-to-date, version-specific library docsContext7
SkillFetch up-to-date documentation and code examples for anyContext7 Documentation Lookup
SkillHow to use the Adaptyv Bio Foundry API and Python SDK
SkillMaster C/.NET backend development patterns for building
SkillGuides the usage of Gemini Interactions API on GeminiGemini Interactions API SkillMore from wshobson
SkillMaster C/.NET backend development patterns for building
SkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliance
SkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Design
SkillMigrate from AngularJS to Angular using hybrid modeAngular migration
SkillUnderstand anti-reversing, obfuscationAnti reversing techniques
SkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patterns