Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/operator/testdata/test-resource-hierarchy.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:latest
10
serviceAccountName: grafana-agent
11
logs:
12
instanceSelector:
13
matchLabels:
14
agent: grafana-agent-example
15
metrics:
16
instanceSelector:
17
matchLabels:
18
agent: grafana-agent-example
19
integrations:
20
selector:
21
matchLabels:
22
agent: grafana-agent-example
23
24
---
25
26
apiVersion: monitoring.grafana.com/v1alpha1
27
kind: MetricsInstance
28
metadata:
29
name: primary
30
namespace: default
31
labels:
32
agent: grafana-agent-example
33
spec:
34
remoteWrite:
35
- url: http://prometheus:9090/api/v1/write
36
basicAuth:
37
username:
38
name: prometheus-fake-credentials
39
key: fakeUsername
40
password:
41
name: prometheus-fake-credentials
42
key: fakePassword
43
# Supply an empty namespace selector to look in all namespaces.
44
podMonitorNamespaceSelector: {}
45
podMonitorSelector:
46
matchLabels:
47
instance: primary
48
# Supply an empty namespace selector to look in all namespaces.
49
serviceMonitorNamespaceSelector: {}
50
serviceMonitorSelector:
51
matchLabels:
52
instance: primary
53
54
---
55
56
apiVersion: monitoring.grafana.com/v1alpha1
57
kind: LogsInstance
58
metadata:
59
name: primary
60
namespace: default
61
labels:
62
agent: grafana-agent-example
63
spec:
64
clients:
65
- url: http://loki:8080/loki/api/v1/push
66
67
# Supply an empty namespace selector to look in all namespaces.
68
podLogsNamespaceSelector: {}
69
podLogsSelector:
70
matchLabels:
71
instance: primary
72
73
---
74
75
apiVersion: monitoring.grafana.com/v1alpha1
76
kind: Integration
77
metadata:
78
name: node-exporter
79
namespace: default
80
labels:
81
agent: grafana-agent-example
82
spec:
83
name: node_exporter
84
type:
85
allNodes: true
86
unique: true
87
config:
88
rootfs_path: /rootfs
89
sysfs_path: /host/sys
90
procfs_path: /host/proc
91
volumeMounts:
92
- mountPath: /host/proc
93
name: proc
94
- mountPath: /host/sys
95
name: sys
96
- mountPath: /rootfs
97
name: root
98
volumes:
99
- hostPath:
100
path: /proc
101
name: proc
102
- hostPath:
103
path: /sys
104
name: sys
105
- hostPath:
106
path: /
107
name: root
108
109
---
110
111
# Have the Agent monitor itself.
112
apiVersion: monitoring.coreos.com/v1
113
kind: PodMonitor
114
metadata:
115
name: grafana-agents
116
namespace: default
117
labels:
118
instance: primary
119
spec:
120
selector:
121
matchLabels:
122
app.kubernetes.io/name: grafana-agent
123
podMetricsEndpoints:
124
- port: http-metrics
125
126
---
127
128
# Have the Agent get logs from itself.
129
apiVersion: monitoring.grafana.com/v1alpha1
130
kind: PodLogs
131
metadata:
132
name: grafana-agents
133
namespace: default
134
labels:
135
instance: primary
136
spec:
137
selector:
138
matchLabels:
139
app.kubernetes.io/name: grafana-agent
140
pipelineStages:
141
- cri: {}
142
143
#
144
# Pretend credentials
145
#
146
147
---
148
apiVersion: v1
149
kind: Secret
150
metadata:
151
name: prometheus-fake-credentials
152
namespace: default
153
data:
154
# "user"
155
fakeUsername: "dXNlcg=="
156
# "password"
157
fakePassword: "cGFzc3dvcmQ="
158
159
#
160
# Extra resources
161
#
162
163
---
164
apiVersion: v1
165
kind: ServiceAccount
166
metadata:
167
name: grafana-agent
168
namespace: default
169
---
170
apiVersion: rbac.authorization.k8s.io/v1
171
kind: ClusterRole
172
metadata:
173
name: grafana-agent
174
rules:
175
- apiGroups:
176
- ""
177
resources:
178
- nodes
179
- nodes/proxy
180
- nodes/metrics
181
- services
182
- endpoints
183
- pods
184
verbs:
185
- get
186
- list
187
- watch
188
- nonResourceURLs:
189
- /metrics
190
- /metrics/cadvisor
191
verbs:
192
- get
193
---
194
apiVersion: rbac.authorization.k8s.io/v1
195
kind: ClusterRoleBinding
196
metadata:
197
name: grafana-agent
198
roleRef:
199
apiGroup: rbac.authorization.k8s.io
200
kind: ClusterRole
201
name: grafana-agent
202
subjects:
203
- kind: ServiceAccount
204
name: grafana-agent
205
namespace: default
206
207