43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
# 部署 Deployment(集群级聚合转发)
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: otel-collector-deployment
|
||
namespace: monitoring
|
||
labels:
|
||
app: otel-collector-deployment
|
||
spec:
|
||
replicas: 1 # 测试环境单副本,生产可扩为2
|
||
selector:
|
||
matchLabels:
|
||
app: otel-collector-deployment
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app: otel-collector-deployment
|
||
spec:
|
||
serviceAccountName: otel-collector
|
||
containers:
|
||
- name: otel-collector
|
||
image: otel/opentelemetry-collector-contrib:latest
|
||
args: ["--config=/etc/otel-collector/config.yaml"]
|
||
volumeMounts:
|
||
- name: otel-config
|
||
mountPath: /etc/otel-collector
|
||
# 暴露端口
|
||
ports:
|
||
- containerPort: 4317 # OTLP gRPC
|
||
- containerPort: 4318 # OTLP HTTP
|
||
- containerPort: 8888 # 自身监控
|
||
# 资源限制
|
||
resources:
|
||
limits:
|
||
cpu: 500m
|
||
memory: 512Mi
|
||
requests:
|
||
cpu: 100m
|
||
memory: 256Mi
|
||
volumes:
|
||
- name: otel-config
|
||
configMap:
|
||
name: otel-collector-config |