57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
|
|
# 部署 DaemonSet(节点级指标采集)
|
|||
|
|
apiVersion: apps/v1
|
|||
|
|
kind: DaemonSet
|
|||
|
|
metadata:
|
|||
|
|
name: otel-collector-daemonset
|
|||
|
|
namespace: monitoring
|
|||
|
|
labels:
|
|||
|
|
app: otel-collector-daemonset
|
|||
|
|
spec:
|
|||
|
|
selector:
|
|||
|
|
matchLabels:
|
|||
|
|
app: otel-collector-daemonset
|
|||
|
|
template:
|
|||
|
|
metadata:
|
|||
|
|
labels:
|
|||
|
|
app: otel-collector-daemonset
|
|||
|
|
spec:
|
|||
|
|
serviceAccountName: otel-collector
|
|||
|
|
hostNetwork: false # 无需主机网络
|
|||
|
|
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
|
|||
|
|
- name: proc
|
|||
|
|
mountPath: /proc
|
|||
|
|
readOnly: true
|
|||
|
|
- name: sys
|
|||
|
|
mountPath: /sys
|
|||
|
|
readOnly: true
|
|||
|
|
- name: rootfs
|
|||
|
|
mountPath: /rootfs
|
|||
|
|
readOnly: true
|
|||
|
|
# 资源限制(按需调整)
|
|||
|
|
resources:
|
|||
|
|
limits:
|
|||
|
|
cpu: 500m
|
|||
|
|
memory: 512Mi
|
|||
|
|
requests:
|
|||
|
|
cpu: 100m
|
|||
|
|
memory: 256Mi
|
|||
|
|
volumes:
|
|||
|
|
- name: otel-config
|
|||
|
|
configMap:
|
|||
|
|
name: otel-collector-config
|
|||
|
|
- name: proc
|
|||
|
|
hostPath:
|
|||
|
|
path: /proc
|
|||
|
|
- name: sys
|
|||
|
|
hostPath:
|
|||
|
|
path: /sys
|
|||
|
|
- name: rootfs
|
|||
|
|
hostPath:
|
|||
|
|
path: /
|