Skip to content

Commit

Permalink
Fix k8s monitoring (#17)
Browse files Browse the repository at this point in the history
* Add k8sattributes processor to otel collector

* Fix monitoring part of kubernetes internals

---------

Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
  • Loading branch information
fcollonval and fcollonval authored Aug 1, 2024
1 parent a0545ab commit aff0d10
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
29 changes: 29 additions & 0 deletions charts/datalayer-observer/templates/collector-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if index .Values "opentelemetry-operator" "enabled" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: datalayer-collector
rules:
- apiGroups: [""]
resources: ["pods", "namespaces", "nodes"]
verbs: ["get", "watch", "list"]
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["extensions"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: datalayer-collector
subjects:
- kind: ServiceAccount
name: datalayer-collector-collector
namespace: {{ default .Values.observer.namespace .Release.Namespace }}
roleRef:
kind: ClusterRole
name: datalayer-collector
apiGroup: rbac.authorization.k8s.io
{{- end }}
8 changes: 6 additions & 2 deletions charts/datalayer-observer/templates/collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318

# https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor#recommended-processors
processors:
# https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor
batch: {}
Expand All @@ -24,6 +26,8 @@ spec:
check_interval: 1s
limit_mib: 4000
spike_limit_mib: 800
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/k8sattributesprocessor
k8sattributes: {}

exporters:
# https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/debugexporter
Expand Down Expand Up @@ -54,10 +58,10 @@ spec:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
processors: [memory_limiter, k8sattributes, batch]
exporters: [otlp]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
processors: [memory_limiter, k8sattributes, batch]
exporters: [prometheus]
{{- end }}
41 changes: 41 additions & 0 deletions charts/datalayer-observer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,47 @@ kube-prometheus-stack:
zookeeper:
url: https://raw.githubusercontent.com/streamnative/apache-pulsar-grafana-dashboard/master/dashboards.kubernetes/zookeeper-3.6.json
datasource: Prometheus
kubeApiServer:
serviceMonitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
kubelet:
serviceMonitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
kubeControllerManager:
serviceMonitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
coreDns:
serviceMonitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
kubeEtcd:
serviceMonitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
kubeScheduler:
serviceMonitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
kubeProxy:
serviceMonitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
kube-state-metrics:
prometheus:
monitor:
additionalLabels:
monitoring.datalayer.io/instance: "observer"
monitoring.datalayer.io/enabled: "true"
prometheus:
enabled: true
prometheusSpec:
Expand Down

0 comments on commit aff0d10

Please sign in to comment.