-
Notifications
You must be signed in to change notification settings - Fork 9
/
otel-agent-mtls.yaml
201 lines (201 loc) · 5.61 KB
/
otel-agent-mtls.yaml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-agent-conf
labels:
app: opentelemetry
component: otel-agent-conf
namespace: otel-system
data:
otel-agent-config: |
receivers:
otlp:
protocols:
grpc:
http:
prometheus:
config:
scrape_configs:
- job_name: 'db_jmx_metrics'
tls_config:
ca_file: /etc/istio-output-certs/root-cert.pem
cert_file: /etc/istio-output-certs/cert-chain.pem
insecure_skip_verify: true
key_file: /etc/istio-output-certs/key.pem
scheme: https
scrape_interval: 15s
metrics_path: '/prometheus/metrics'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- day2-operations
relabel_configs:
- action: keep
source_labels:
- __meta_kubernetes_service_label_app
regex: day2-service
- action: keep
source_labels:
- __meta_kubernetes_endpoint_port_name
regex: http-web
- job_name: 'prometheus-federate'
scrape_timeout: 30s
honor_labels: false
metrics_path: '/federate'
params:
'match[]':
- '{__name__=~"event(.*)"}'
- '{__name__=~"loki(.*)",__name__!="loki_ingester_checkpoint_duration_seconds"}'
- '{__name__=~"fluentbit(.*)"}'
- '{__name__=~"servicecatalog(.*)"}'
- '{__name__=~"controller_runtime(.*)"}'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- kyma-system
relabel_configs:
- action: keep
source_labels:
- __meta_kubernetes_service_label_app
regex: monitoring-prometheus
- action: keep
source_labels:
- __meta_kubernetes_endpoint_port_name
regex: http-web
exporters:
dynatrace:
endpoint: "${API_ENDPOINT}"
api_token: "${API_TOKEN}"
processors:
batch:
# Batch size must be less than or equal to 1000
send_batch_size: 500
send_batch_max_size: 500
timeout: 30s
memory_limiter:
# Same as --mem-ballast-size-mib CLI argument
# ballast_size_mib: 165
# 80% of maximum memory up to 2G
limit_mib: 400
# 25% of limit up to 2G
spike_limit_mib: 100
check_interval: 5s
service:
telemetry:
logs:
level: INFO # DEBUG
pipelines:
metrics:
receivers: [prometheus]
processors: [memory_limiter, batch]
exporters: [dynatrace]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: otel-agent
namespace: otel-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: otel-agent
rules:
- apiGroups: [""]
resources:
- nodes
- nodes/metrics
- services
- endpoints
- pods
verbs: ["get", "list", "watch"]
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses
verbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics", "/metrics/cadvisor"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: otel-agent
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: otel-agent
subjects:
- kind: ServiceAccount
name: otel-agent
namespace: otel-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-agent
labels:
app: opentelemetry
component: otel-agent
namespace: otel-system
spec:
selector:
matchLabels:
app: opentelemetry
component: otel-agent
template:
metadata:
labels:
app: opentelemetry
component: otel-agent
sidecar.istio.io/inject: "true"
annotations:
proxy.istio.io/config: |
# configure an env variable `OUTPUT_CERTS` to write certificates to the given folder
proxyMetadata:
OUTPUT_CERTS: /etc/istio-output-certs
sidecar.istio.io/userVolumeMount: '[{"name": "istio-certs", "mountPath": "/etc/istio-output-certs"}]'
traffic.sidecar.istio.io/includeInboundPorts: ""
traffic.sidecar.istio.io/includeOutboundIPRanges: ""
spec:
containers:
- name: otel-agent
image: otel/opentelemetry-collector-contrib:latest
args:
- --config=/etc/otel/config.yaml
env:
- name: API_TOKEN
valueFrom:
secretKeyRef:
name: dynakube
key: API_TOKEN
- name: API_ENDPOINT
valueFrom:
secretKeyRef:
name: dynakube
key: API_ENDPOINT
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /etc/otel/config.yaml
name: data
subPath: otel-agent-config
readOnly: true
- mountPath: /etc/istio-output-certs
name: istio-certs
readOnly: true
volumes:
- name: data
configMap:
name: otel-agent-conf
- name: istio-certs
emptyDir: {}
serviceAccountName: otel-agent