-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcadvisor-exporter.yaml
More file actions
115 lines (114 loc) · 3.4 KB
/
cadvisor-exporter.yaml
File metadata and controls
115 lines (114 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: wes-telegraf-cadvisor
namespace: default
rules:
- apiGroups: [""] # "" indicates the core API group
resources:
- "nodes"
- "nodes/proxy"
- "services"
- "endpoints"
- "pods"
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: wes-telegraf-cadvisor-view
namespace: default
roleRef:
kind: ClusterRole
name: wes-telegraf-cadvisor
apiGroup: rbac.authorization.k8s.io
# `edit` is a built-in cluster role. more info about these can be found here:
# https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles
subjects:
- kind: ServiceAccount
name: wes-telegraf-cadvisor-account
namespace: default
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: wes-telegraf-cadvisor-account
---
# NOTE (Yongho): putting monitor_kubernetes_pods_method = "annotations"
# in telegraf.conf returns an error by telegraf. I have no idea why
# but without it telegraf works (and annotations is set by default)
apiVersion: v1
kind: ConfigMap
metadata:
name: wes-telegraf-cadvisor-telegraf-config
data:
telegraf.conf: |
[[inputs.prometheus]]
urls = ["https://kubernetes.default.svc.cluster.local:443/api/v1/nodes/${NODE_NAME}/proxy/metrics/cadvisor"]
bearer_token = "/var/run/secrets/kubernetes.io/serviceaccount/token"
tls_ca = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
monitor_kubernetes_pods = true
pod_scrape_scope = "node"
[[outputs.influxdb_v2]]
urls = ["http://wes-node-influxdb.default.svc.cluster.local:8086"]
token = "${INFLUXDB_TOKEN}"
organization = "${INFLUXDB_ORG}"
bucket = "${INFLUXDB_BUCKET}"
---
# Runs one instance of node-exporter on every node (DaemonSet) and expose
# the service on port 9100 on every node host.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: wes-telegraf-cadvisor
labels:
app.kubernetes.io/name: wes-telegraf-cadvisor
app.kubernetes.io/version: 1.22.4
spec:
selector:
matchLabels:
app.kubernetes.io/name: wes-telegraf-cadvisor
template:
metadata:
labels:
app.kubernetes.io/name: wes-telegraf-cadvisor
app.kubernetes.io/version: 1.22.4
spec:
serviceAccountName: wes-telegraf-cadvisor-account
priorityClassName: wes-high-priority
containers:
- name: wes-telegraf-cadvisor
image: telegraf:1.22.4
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 100m
memory: 60Mi
limits:
memory: 60Mi
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: INFLUXDB_TOKEN
valueFrom:
secretKeyRef:
name: wes-node-influxdb-waggle-token
key: token
- name: INFLUXDB_BUCKET
value: "waggle"
- name: INFLUXDB_ORG
value: "waggle"
volumeMounts:
- mountPath: /etc/telegraf
name: telegraf-conf
volumes:
- name: telegraf-conf
configMap:
name: wes-telegraf-cadvisor-telegraf-config