Loading...
Loading...
Compare original and translation side by side
Linkerd:
├── Control Plane
│ ├── Destination (service discovery)
│ ├── Identity (mTLS certificates)
│ ├── Proxy Injector (sidecar injection)
│ └── Public API (metrics/control)
└── Data Plane
├── Linkerd Proxy (Rust-based)
├── Init Container (iptables setup)
└── Proxy Metrics
Key Features:
- Automatic mTLS
- Golden metrics out-of-the-box
- Ultra-lightweight (written in Rust)
- Zero-config service discoveryLinkerd:
├── Control Plane
│ ├── Destination (service discovery)
│ ├── Identity (mTLS certificates)
│ ├── Proxy Injector (sidecar injection)
│ └── Public API (metrics/control)
└── Data Plane
├── Linkerd Proxy (Rust-based)
├── Init Container (iptables setup)
└── Proxy Metrics
核心特性:
- 自动mTLS
- 开箱即用黄金指标
- 超轻量(Rust编写)
- 零配置服务发现undefinedundefined
**Production Installation:**
```bash
**生产环境安装:**
```bashundefinedundefinedundefinedundefined
**Namespace with Injection:**
```yaml
apiVersion: v1
kind: Namespace
metadata:
name: production
annotations:
linkerd.io/inject: enabledapiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
namespace: production
spec:
template:
metadata:
annotations:
linkerd.io/inject: enabled
spec:
containers:
- name: myapp
image: myapp:latestmetadata:
annotations:
linkerd.io/inject: enabled
config.linkerd.io/skip-inbound-ports: "8080,8443"
config.linkerd.io/skip-outbound-ports: "3306,5432"metadata:
annotations:
linkerd.io/inject: enabled
config.linkerd.io/proxy-cpu-request: "100m"
config.linkerd.io/proxy-memory-request: "128Mi"
config.linkerd.io/proxy-cpu-limit: "1000m"
config.linkerd.io/proxy-memory-limit: "256Mi"
config.linkerd.io/proxy-log-level: "info,linkerd=debug"
**已开启注入的命名空间配置:**
```yaml
apiVersion: v1
kind: Namespace
metadata:
name: production
annotations:
linkerd.io/inject: enabledapiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
namespace: production
spec:
template:
metadata:
annotations:
linkerd.io/inject: enabled
spec:
containers:
- name: myapp
image: myapp:latestmetadata:
annotations:
linkerd.io/inject: enabled
config.linkerd.io/skip-inbound-ports: "8080,8443"
config.linkerd.io/skip-outbound-ports: "3306,5432"metadata:
annotations:
linkerd.io/inject: enabled
config.linkerd.io/proxy-cpu-request: "100m"
config.linkerd.io/proxy-memory-request: "128Mi"
config.linkerd.io/proxy-cpu-limit: "1000m"
config.linkerd.io/proxy-memory-limit: "256Mi"
config.linkerd.io/proxy-log-level: "info,linkerd=debug"apiVersion: split.smi-spec.io/v1alpha2
kind: TrafficSplit
metadata:
name: myapp-canary
namespace: production
spec:
service: myapp
backends:
- service: myapp-v1
weight: 90
- service: myapp-v2
weight: 10
---apiVersion: split.smi-spec.io/v1alpha2
kind: TrafficSplit
metadata:
name: myapp-canary
namespace: production
spec:
service: myapp
backends:
- service: myapp-v1
weight: 90
- service: myapp-v2
weight: 10
---
**HTTPRoute (Fine-Grained Routing):**
```yaml
apiVersion: policy.linkerd.io/v1beta1
kind: HTTPRoute
metadata:
name: myapp-routes
namespace: production
spec:
parentRefs:
- name: myapp
kind: Service
group: core
port: 80
rules:
# Route based on header
- matches:
- headers:
- name: x-canary
value: "true"
backendRefs:
- name: myapp-v2
port: 80
# Route based on path
- matches:
- path:
type: PathPrefix
value: /api/v2
backendRefs:
- name: myapp-v2
port: 80
# Default route
- backendRefs:
- name: myapp-v1
port: 80
weight: 90
- name: myapp-v2
port: 80
weight: 10
**HTTPRoute(精细化路由):**
```yaml
apiVersion: policy.linkerd.io/v1beta1
kind: HTTPRoute
metadata:
name: myapp-routes
namespace: production
spec:
parentRefs:
- name: myapp
kind: Service
group: core
port: 80
rules:
# 基于请求头路由
- matches:
- headers:
- name: x-canary
value: "true"
backendRefs:
- name: myapp-v2
port: 80
# 基于路径路由
- matches:
- path:
type: PathPrefix
value: /api/v2
backendRefs:
- name: myapp-v2
port: 80
# 默认路由
- backendRefs:
- name: myapp-v1
port: 80
weight: 90
- name: myapp-v2
port: 80
weight: 10apiVersion: policy.linkerd.io/v1alpha1
kind: HTTPRoute
metadata:
name: myapp-retries
namespace: production
spec:
parentRefs:
- name: myapp
kind: Service
rules:
- matches:
- path:
type: PathPrefix
value: /api
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
set:
- name: l5d-retry-http
value: "5xx"
- name: l5d-retry-limit
value: "3"
backendRefs:
- name: myapp
port: 80apiVersion: policy.linkerd.io/v1alpha1
kind: HTTPRoute
metadata:
name: myapp-timeouts
namespace: production
spec:
parentRefs:
- name: myapp
kind: Service
rules:
- matches:
- path:
type: PathPrefix
value: /api
timeouts:
request: 10s
backendRequest: 8s
backendRefs:
- name: myapp
port: 80apiVersion: linkerd.io/v1alpha2
kind: ServiceProfile
metadata:
name: myapp.production.svc.cluster.local
namespace: production
spec:
routes:
- name: GET /api/users
condition:
method: GET
pathRegex: /api/users
responseClasses:
- condition:
status:
min: 500
max: 599
isFailure: true
retryBudget:
retryRatio: 0.2
minRetriesPerSecond: 10
ttl: 10sapiVersion: policy.linkerd.io/v1alpha1
kind: HTTPRoute
metadata:
name: myapp-retries
namespace: production
spec:
parentRefs:
- name: myapp
kind: Service
rules:
- matches:
- path:
type: PathPrefix
value: /api
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
set:
- name: l5d-retry-http
value: "5xx"
- name: l5d-retry-limit
value: "3"
backendRefs:
- name: myapp
port: 80apiVersion: policy.linkerd.io/v1alpha1
kind: HTTPRoute
metadata:
name: myapp-timeouts
namespace: production
spec:
parentRefs:
- name: myapp
kind: Service
rules:
- matches:
- path:
type: PathPrefix
value: /api
timeouts:
request: 10s
backendRequest: 8s
backendRefs:
- name: myapp
port: 80apiVersion: linkerd.io/v1alpha2
kind: ServiceProfile
metadata:
name: myapp.production.svc.cluster.local
namespace: production
spec:
routes:
- name: GET /api/users
condition:
method: GET
pathRegex: /api/users
responseClasses:
- condition:
status:
min: 500
max: 599
isFailure: true
retryBudget:
retryRatio: 0.2
minRetriesPerSecond: 10
ttl: 10sapiVersion: policy.linkerd.io/v1beta1
kind: Server
metadata:
name: myapp-server
namespace: production
spec:
podSelector:
matchLabels:
app: myapp
port: 8080
proxyProtocol: HTTP/2apiVersion: policy.linkerd.io/v1beta1
kind: ServerAuthorization
metadata:
name: myapp-auth
namespace: production
spec:
server:
name: myapp-server
client:
# Allow from specific service account
meshTLS:
serviceAccounts:
- name: frontend
namespace: production
# Allow unauthenticated (for ingress)
unauthenticated: true
# Allow from specific namespaces
meshTLS:
identities:
- "*.production.serviceaccount.identity.linkerd.cluster.local"undefinedapiVersion: policy.linkerd.io/v1beta1
kind: Server
metadata:
name: myapp-server
namespace: production
spec:
podSelector:
matchLabels:
app: myapp
port: 8080
proxyProtocol: HTTP/2apiVersion: policy.linkerd.io/v1beta1
kind: ServerAuthorization
metadata:
name: myapp-auth
namespace: production
spec:
server:
name: myapp-server
client:
# 允许来自特定服务账户的请求
meshTLS:
serviceAccounts:
- name: frontend
namespace: production
# 允许未认证请求(适用于入口网关)
unauthenticated: true
# 允许来自特定命名空间的请求
meshTLS:
identities:
- "*.production.serviceaccount.identity.linkerd.cluster.local"undefinedundefinedundefinedundefinedundefined
**Service Export:**
```yaml
apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: production
labels:
mirror.linkerd.io/exported: "true"
spec:
selector:
app: myapp
ports:
- port: 80
targetPort: 8080
**服务导出:**
```yaml
apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: production
labels:
mirror.linkerd.io/exported: "true"
spec:
selector:
app: myapp
ports:
- port: 80
targetPort: 8080undefinedundefined
**Prometheus Metrics:**
```promql
**Prometheus指标:**
```promql
**Jaeger Integration:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: linkerd-config-overrides
namespace: linkerd
data:
global: |
tracing:
collector:
endpoint: jaeger.linkerd-jaeger:55678
sampling:
rate: 1.0
**Jaeger集成:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: linkerd-config-overrides
namespace: linkerd
data:
global: |
tracing:
collector:
endpoint: jaeger.linkerd-jaeger:55678
sampling:
rate: 1.0undefinedundefined
**Mesh Operations:**
```bash
**网格操作:**
```bash
**Observability:**
```bash
**可观测性:**
```bash
**Diagnostics:**
```bash
**诊断:**
```bashundefinedundefinedundefinedundefinedundefinedundefinedannotations:
config.linkerd.io/proxy-cpu-limit: "1000m"
config.linkerd.io/proxy-memory-limit: "256Mi"annotations:
config.linkerd.io/proxy-cpu-limit: "1000m"
config.linkerd.io/proxy-memory-limit: "256Mi"undefinedundefinedundefinedundefined- Success Rate (requests/sec)
- Request Volume (RPS)
- Latency (P50, P95, P99)- 成功率(请求/秒)
- 请求量(RPS)
- 延迟(P50, P95, P99)undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined
**2. Skip Ports Unnecessarily:**
```yaml
**2. 不必要地跳过端口:**
```yaml
**3. No Authorization Policies:**
```yaml
**3. 未配置授权策略:**
```yaml
**4. Ignoring Metrics:**
```bash
**4. 忽略监控指标:**
```bashundefinedundefined