# 部署主体 (Deployment) apiVersion: apps/v1 kind: Deployment metadata: name: otel-gateway namespace: monitoring labels: app: otel-gateway spec: replicas: 1 # 采集 Events 和 KSM 建议单副本,避免数据重复 selector: matchLabels: app: otel-gateway template: metadata: labels: app: otel-gateway spec: serviceAccountName: otel-gateway containers: - name: otel-collector image: otel/opentelemetry-collector-contrib:latest command: - "/otelcol-contrib" args: - "--config=/conf/config.yaml" volumeMounts: - name: config-vol mountPath: /conf resources: limits: cpu: 1 memory: 2Gi requests: cpu: 200m memory: 400Mi volumes: - name: config-vol configMap: name: otel-gateway-config --- # 服务暴露 (Service) apiVersion: v1 kind: Service metadata: name: otel-gateway namespace: monitoring spec: clusterIP: None selector: app: otel-gateway ports: - name: grpc port: 4317 targetPort: 4317 protocol: TCP - name: http port: 4318 targetPort: 4318 protocol: TCP