| name | istio |
| description | Manage Istio service mesh configurations, traffic management, security policies, and observability. Use when working with Istio, service mesh, traffic routing, virtual services, destination rules, gateways, mTLS, authentication policies, authorization policies, or microservices networking in Kubernetes. |
Istio Service Mesh Management
Comprehensive expertise for managing Istio service mesh in Kubernetes environments, including traffic management, security, and observability configurations.
Core Capabilities
This skill helps with:
- Traffic Management: VirtualServices, DestinationRules, Gateways, ServiceEntries
- Security: PeerAuthentication, RequestAuthentication, AuthorizationPolicies, mTLS configuration
- Observability: Telemetry, metrics, tracing, logging configuration
- Networking: Sidecars, WorkloadEntries, EnvoyFilters
- Multi-cluster: Multi-cluster mesh configuration and troubleshooting
Prerequisites
Required tools (I'll check for these):
kubectl - Kubernetes CLI
istioctl - Istio CLI tool
Optional but recommended:
helm - For Istio installation via Helm charts
Quick Start Examples
Check Istio Installation
istioctl version
kubectl -n istio-system get pods
istioctl proxy-status
Traffic Management
Create a VirtualService for canary deployment:
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-service
spec:
hosts:
- my-service
http:
- match:
- headers:
canary:
exact: "true"
route:
- destination:
host: my-service
subset: v2
- route:
- destination:
host: my-service
subset: v1
weight: 90
- destination:
host: my-service
subset: v2
weight: 10
Create corresponding DestinationRule:
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: my-service
spec:
host: my-service
trafficPolicy:
connectionPool:
tcp:
maxConnections: 100
http:
http1MaxPendingRequests: 50
http2MaxRequests: 100
outlierDetection:
consecutiveErrors: 5
interval: 30s
baseEjectionTime: 30s
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
Security Configuration
Enable strict mTLS mesh-wide:
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: istio-system
spec:
mtls:
mode: STRICT
Create an AuthorizationPolicy:
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: frontend-policy
namespace: default
spec:
selector:
matchLabels:
app: frontend
action: ALLOW
rules:
- from:
- source:
principals: ["cluster.local/ns/default/sa/backend"]
to:
- operation:
methods: ["GET", "POST"]
paths: ["/api/*"]
Gateway Configuration
Create an Ingress Gateway:
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: my-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "example.com"
- port:
number: 443
name: https
protocol: HTTPS
tls:
mode: SIMPLE
credentialName: example-credential
hosts:
- "example.com"
Common Workflows
1. Deploy a New Service with Istio
kubectl label namespace default istio-injection=enabled
kubectl apply -f deployment.yaml
kubectl get pods -o jsonpath='{.items[*].spec.containers[*].name}'
kubectl apply -f virtualservice.yaml
kubectl apply -f destinationrule.yaml
kubectl exec -it pod-name -c istio-proxy -- curl http://my-service
2. Implement Canary Deployment
kubectl apply -f deployment-v2.yaml
kubectl apply -f virtualservice-canary.yaml
istioctl dashboard prometheus
kubectl delete -f deployment-v1.yaml
3. Configure Circuit Breaking
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: circuit-breaker
spec:
host: my-service
trafficPolicy:
connectionPool:
tcp:
maxConnections: 100
http:
http1MaxPendingRequests: 10
maxRequestsPerConnection: 2
outlierDetection:
consecutiveErrors: 5
interval: 10s
baseEjectionTime: 30s
maxEjectionPercent: 50
minHealthPercent: 40
4. Enable Request Timeout and Retries
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: timeout-retry
spec:
hosts:
- my-service
http:
- route:
- destination:
host: my-service
timeout: 10s
retries:
attempts: 3
perTryTimeout: 2s
retryOn: 5xx,reset,connect-failure,refused-stream
Troubleshooting Guide
Common Issues and Solutions
Issue: Sidecar not injected
kubectl get namespace -L istio-injection
kubectl get pod pod-name -o yaml | grep sidecar.istio.io
istioctl kube-inject -f deployment.yaml | kubectl apply -f -
Issue: Traffic not routing correctly
kubectl get virtualservice my-service -o yaml
kubectl get destinationrule my-service -o yaml
istioctl proxy-config routes pod-name
kubectl logs pod-name -c istio-proxy
Issue: mTLS connection failures
kubectl get peerauthentication -A
istioctl proxy-config secret pod-name
istioctl experimental authz check pod-name
Issue: High latency or timeouts
istioctl proxy-config cluster pod-name --fqdn my-service
istioctl dashboard prometheus
kubectl logs -n istio-system deploy/istiod | grep outlier
Diagnostic Commands
Proxy Status and Configuration
istioctl proxy-status
istioctl proxy-config cluster pod-name
istioctl proxy-config listener pod-name
istioctl proxy-config route pod-name
istioctl proxy-config endpoint pod-name
istioctl proxy-config bootstrap pod-name
istioctl proxy-config secret pod-name
Validation and Analysis
istioctl analyze
istioctl validate -f virtualservice.yaml
istioctl analyze --namespace default
istioctl experimental describe pod pod-name
istioctl experimental wait --for=distribution virtualservice/my-service
Metrics and Observability
istioctl dashboard kiali
istioctl dashboard prometheus
istioctl dashboard grafana
istioctl dashboard jaeger
kubectl exec -it pod-name -c istio-proxy -- curl localhost:15000/stats/prometheus
Security Best Practices
1. Enable Strict mTLS
Always enable strict mTLS for production environments:
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: istio-system
spec:
mtls:
mode: STRICT
2. Implement Fine-grained Authorization
Use AuthorizationPolicies with least privilege principle:
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: deny-all
namespace: default
spec:
action: DENY
rules:
- {}
---
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: allow-specific
namespace: default
spec:
selector:
matchLabels:
app: my-app
action: ALLOW
rules:
- from:
- source:
principals: ["cluster.local/ns/default/sa/frontend"]
to:
- operation:
methods: ["GET"]
3. JWT Authentication
Configure JWT validation for external authentication:
apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: jwt-auth
namespace: default
spec:
selector:
matchLabels:
app: my-app
jwtRules:
- issuer: "https://auth.example.com"
jwksUri: "https://auth.example.com/.well-known/jwks.json"
audiences:
- "my-app"
Performance Optimization
Resource Management
apiVersion: v1
kind: Pod
metadata:
annotations:
sidecar.istio.io/proxyCPU: "100m"
sidecar.istio.io/proxyMemory: "128Mi"
sidecar.istio.io/proxyCPULimit: "500m"
sidecar.istio.io/proxyMemoryLimit: "512Mi"
Sidecar Scoping
Reduce sidecar configuration overhead:
apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
name: default
namespace: default
spec:
egress:
- hosts:
- "./*"
- "istio-system/*"
Advanced Patterns
Multi-cluster Configuration
For detailed multi-cluster setup, see MULTICLUSTER.md.
Custom Envoy Filters
For advanced Envoy configuration, see ENVOYFILTER.md.
Telemetry Configuration
For observability setup, see TELEMETRY.md.
Working with This Skill
When you ask me to:
- Create or modify Istio resources, I'll provide proper YAML configurations
- Debug issues, I'll guide you through systematic troubleshooting
- Implement patterns, I'll suggest best practices and gotchas
- Analyze configurations, I'll use
istioctl analyze and other diagnostic tools
I always:
- Check if required tools are available
- Verify current Istio version for compatibility
- Validate configurations before applying
- Provide rollback steps for risky changes
- Include monitoring and verification steps
Version Compatibility
This skill is tested with:
- Istio 1.18.x - 1.24.x
- Kubernetes 1.26.x - 1.31.x
For version-specific features, I'll note compatibility requirements.
Additional Resources
For more detailed guidance on specific topics: