55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
|
|
# 部署主体 (DaemonSet)
|
||
|
|
apiVersion: apps/v1
|
||
|
|
kind: DaemonSet
|
||
|
|
metadata:
|
||
|
|
name: otel-agent
|
||
|
|
namespace: monitoring
|
||
|
|
labels:
|
||
|
|
app: otel-agent
|
||
|
|
spec:
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
app: otel-agent
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app: otel-agent
|
||
|
|
spec:
|
||
|
|
hostNetwork: true
|
||
|
|
dnsPolicy: ClusterFirstWithHostNet
|
||
|
|
serviceAccountName: otel-agent
|
||
|
|
containers:
|
||
|
|
- name: otel-collector
|
||
|
|
image: otel/opentelemetry-collector-contrib:latest
|
||
|
|
command:
|
||
|
|
- "/otelcol-contrib"
|
||
|
|
args:
|
||
|
|
- "--config=/conf/config.yaml"
|
||
|
|
env:
|
||
|
|
# 获取当前节点名称,传给 kubeletstats 使用
|
||
|
|
- name: K8S_NODE_NAME
|
||
|
|
valueFrom:
|
||
|
|
fieldRef:
|
||
|
|
fieldPath: spec.nodeName
|
||
|
|
volumeMounts:
|
||
|
|
- name: config-vol
|
||
|
|
mountPath: /conf
|
||
|
|
# 挂载宿主机根目录,以便采集宿主机指标
|
||
|
|
- name: hostfs
|
||
|
|
mountPath: /hostfs
|
||
|
|
readOnly: true
|
||
|
|
mountPropagation: HostToContainer
|
||
|
|
resources:
|
||
|
|
limits:
|
||
|
|
cpu: 500m
|
||
|
|
memory: 500Mi
|
||
|
|
requests:
|
||
|
|
cpu: 100m
|
||
|
|
memory: 200Mi
|
||
|
|
volumes:
|
||
|
|
- name: config-vol
|
||
|
|
configMap:
|
||
|
|
name: otel-agent-config
|
||
|
|
- name: hostfs
|
||
|
|
hostPath:
|
||
|
|
path: /
|