Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/operator/testdata/test-integrations.in.yaml
4095 views
1
apiVersion: monitoring.grafana.com/v1alpha1
2
kind: GrafanaAgent
3
metadata:
4
name: grafana-agent-example
5
namespace: default
6
labels:
7
app: grafana-agent-example
8
spec:
9
image: grafana/agent:main
10
logLevel: info
11
serviceAccountName: grafana-agent
12
storage:
13
volumeClaimTemplate:
14
spec:
15
resources:
16
requests:
17
storage: 1Gi
18
logs:
19
instanceSelector:
20
matchLabels:
21
agent: grafana-agent-example
22
metrics:
23
instanceSelector:
24
matchLabels:
25
agent: grafana-agent-example
26
integrations:
27
selector:
28
matchLabels:
29
agent: grafana-agent-example
30
31
---
32
33
apiVersion: monitoring.grafana.com/v1alpha1
34
kind: MetricsInstance
35
metadata:
36
name: primary
37
namespace: default
38
labels:
39
agent: grafana-agent-example
40
spec:
41
remoteWrite:
42
- url: http://prometheus:9090/api/v1/write
43
podMonitorNamespaceSelector: {}
44
podMonitorSelector:
45
matchLabels:
46
instance: primary
47
48
---
49
50
apiVersion: monitoring.grafana.com/v1alpha1
51
kind: LogsInstance
52
metadata:
53
name: primary
54
namespace: default
55
labels:
56
agent: grafana-agent-example
57
spec:
58
clients:
59
- url: http://loki:8080/loki/api/v1/push
60
61
# Supply an empty namespace selector to look in all namespaces.
62
podLogsNamespaceSelector: {}
63
podLogsSelector:
64
matchLabels:
65
instance: primary
66
67
---
68
69
# Have the Agent monitor itself.
70
apiVersion: monitoring.coreos.com/v1
71
kind: PodMonitor
72
metadata:
73
name: grafana-agents
74
namespace: default
75
labels:
76
instance: primary
77
spec:
78
selector:
79
matchLabels:
80
app.kubernetes.io/name: grafana-agent
81
podMetricsEndpoints:
82
- port: http-metrics
83
84
---
85
86
# Have the Agent get logs from itself.
87
apiVersion: monitoring.grafana.com/v1alpha1
88
kind: PodLogs
89
metadata:
90
name: grafana-agents
91
namespace: default
92
labels:
93
instance: primary
94
spec:
95
selector:
96
matchLabels:
97
app.kubernetes.io/name: grafana-agent
98
pipelineStages:
99
- cri: {}
100
101
---
102
103
# Collect node_exporter metrics.
104
apiVersion: monitoring.grafana.com/v1alpha1
105
kind: Integration
106
metadata:
107
name: node-exporter
108
namespace: default
109
labels:
110
agent: grafana-agent-example
111
spec:
112
name: node_exporter
113
type:
114
allNodes: true
115
unique: true
116
config:
117
autoscrape:
118
enable: true
119
metrics_instance: default/primary
120
rootfs_path: /default/node_exporter/rootfs
121
sysfs_path: /default/node_exporter/sys
122
procfs_path: /default/node_exporter/proc
123
volumeMounts:
124
- mountPath: /default/node_exporter/proc
125
name: proc
126
- mountPath: /default/node_exporter/sys
127
name: sys
128
- mountPath: /default/node_exporter/rootfs
129
name: root
130
volumes:
131
- name: proc
132
hostPath:
133
path: /proc
134
- name: sys
135
hostPath:
136
path: /sys
137
- name: root
138
hostPath:
139
path: /root
140
# These aren't really used here, but just being mounted for local testing.
141
secrets:
142
- name: fake-secret
143
key: key
144
configMaps:
145
- name: fake-configmap
146
key: foo
147
148
---
149
150
# Collect kubernetes API events.
151
apiVersion: monitoring.grafana.com/v1alpha1
152
kind: Integration
153
metadata:
154
name: eventhandler
155
namespace: default
156
labels:
157
agent: grafana-agent-example
158
spec:
159
name: eventhandler
160
type:
161
unique: true
162
config:
163
logs_instance: default/primary
164
cache_path: "/var/lib/grafana-agent/data/eventhandler.cache"
165
166
---
167
168
#
169
# Pretend Secrets/ConfigMaps
170
#
171
172
---
173
apiVersion: v1
174
kind: Secret
175
metadata:
176
name: fake-secret
177
namespace: default
178
stringData:
179
key: "value"
180
181
---
182
apiVersion: v1
183
kind: ConfigMap
184
metadata:
185
name: fake-configmap
186
namespace: default
187
data:
188
foo: "bar"
189
190
#
191
# Extra resources
192
#
193
194
---
195
apiVersion: v1
196
kind: ServiceAccount
197
metadata:
198
name: grafana-agent
199
namespace: default
200
---
201
apiVersion: rbac.authorization.k8s.io/v1
202
kind: ClusterRole
203
metadata:
204
name: grafana-agent
205
rules:
206
- apiGroups:
207
- ""
208
resources:
209
- nodes
210
- nodes/proxy
211
- nodes/metrics
212
- services
213
- endpoints
214
- pods
215
- events # needed for eventhandler integration
216
verbs:
217
- get
218
- list
219
- watch
220
- nonResourceURLs:
221
- /metrics
222
- /metrics/cadvisor
223
verbs:
224
- get
225
---
226
apiVersion: rbac.authorization.k8s.io/v1
227
kind: ClusterRoleBinding
228
metadata:
229
name: grafana-agent
230
roleRef:
231
apiGroup: rbac.authorization.k8s.io
232
kind: ClusterRole
233
name: grafana-agent
234
subjects:
235
- kind: ServiceAccount
236
name: grafana-agent
237
namespace: default
238
239