Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #25 from matej-g/move-kube-metrics-to-collector
Browse files Browse the repository at this point in the history
Move extra Kubernetes metrics to collector
  • Loading branch information
matej-g authored Aug 8, 2023
2 parents b11ece3 + 886de75 commit 544f9fa
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 63 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Coralogix Opentelemetry Integration

### v0.9.0 / 2023-08-08
* [FIX] Limit kube-state-metrics scraping to chart's instance only
* [FIX] Move extra Kubernetes metrics to collector instead of agent
* [FEATURE] Make `k8s.node.name` label the target node for Kubernetes node info metric

### v0.8.0 / 2023-08-03
* [FEATURE] Add cluster metrics related to allocatable resources (CPU, memory)

Expand Down
2 changes: 1 addition & 1 deletion charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: coralogix-opentelemetry-integration
description: OpenTelemetry barebones to have Coralogix Kubernetes Monitoring working out-of-the-box.
version: 0.8.0
version: 0.9.0
kubeVersion: ">=1.16.0-0"
keywords:
- OpenTelemetry Collector
Expand Down
128 changes: 66 additions & 62 deletions charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,6 @@ opentelemetry-collector-agent:
# Best used with mode = daemonset.
kubeletMetrics:
enabled: true

# Extra role rules are required in order to fetch kubelet and kuberenetes API metrics.
clusterRole:
rules:
- apiGroups:
- ""
resources:
- nodes
- nodes/metrics
- endpoints
- services
verbs:
- get
- list
- watch
- nonResourceURLs:
- "/metrics"
verbs:
- get

config:
extensions:
Expand All @@ -71,43 +52,9 @@ opentelemetry-collector-agent:
watch_observers: [k8s_observer]
receivers:
prometheus_simple:
rule: type == "port" && port == 8080 && pod.name contains "kube-state-metrics"
rule: type == "port" && port == 8080 && pod.name contains "{{ .Release.Name }}-kube-state-metrics"
config:
endpoint: '`endpoint`'
prometheus/kube_extra_metrics:
config:
scrape_configs:
- job_name: kubernetes-apiserver
honor_timestamps: true
scheme: https
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- source_labels:
[
__meta_kubernetes_namespace,
__meta_kubernetes_service_name,
__meta_kubernetes_endpoint_port_name,
]
action: keep
regex: default;kubernetes;https
- job_name: kubernetes-cadvisor
honor_timestamps: true
metrics_path: /metrics/cadvisor
scheme: https
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)

processors:
resourcedetection/env:
Expand All @@ -132,7 +79,7 @@ opentelemetry-collector-agent:
enabled: true
metricstransform:
transforms:
include: .*
- include: .*
match_type: regexp
action: update
operations:
Expand All @@ -142,6 +89,14 @@ opentelemetry-collector-agent:
- action: add_label
new_label: cx.otel_integration.name
new_value: "{{ .Chart.Name }}"
# Replace node name for kube node info with the name of the target node.
- include: kube_node_info
match_type: strict
action: update
operations:
- action: update_label
label: node
new_label: k8s.node.name
filter/metrics:
metrics:
include:
Expand All @@ -164,12 +119,6 @@ opentelemetry-collector-agent:
- kube_node_info
- kube_pod_status_reason
- kube_pod_status_qos_class
- kubernetes_build_info
- container_fs_writes_total
- container_fs_writes_bytes_total
- container_fs_reads_total
- container_fs_reads_bytes_total
- container_fs_usage_bytes

exporters:
coralogix:
Expand Down Expand Up @@ -217,7 +166,6 @@ opentelemetry-collector-agent:
- prometheus
- hostmetrics
- receiver_creator/ksm_prometheus
- prometheus/kube_extra_metrics

opentelemetry-collector-events:
enabled: true
Expand Down Expand Up @@ -252,9 +200,58 @@ opentelemetry-collector-events:
- apiGroups: ["", "events.k8s.io"]
resources: ["events"]
verbs: ["watch", "list"]
- apiGroups:
- ""
resources:
- nodes
- nodes/metrics
- endpoints
- services
verbs:
- get
- list
- watch
- nonResourceURLs:
- "/metrics"
verbs:
- get

config:
receivers:
prometheus/kube_extra_metrics:
config:
scrape_configs:
- job_name: kubernetes-apiserver
honor_timestamps: true
scheme: https
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- source_labels:
[
__meta_kubernetes_namespace,
__meta_kubernetes_service_name,
__meta_kubernetes_endpoint_port_name,
]
action: keep
regex: default;kubernetes;https
- job_name: kubernetes-cadvisor
honor_timestamps: true
metrics_path: /metrics/cadvisor
scheme: https
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
k8sobjects:
objects:
- group: events.k8s.io
Expand Down Expand Up @@ -317,6 +314,12 @@ opentelemetry-collector-events:
- k8s.container.cpu_request
- k8s.container.memory_limit
- k8s.container.memory_request
- kubernetes_build_info
- container_fs_writes_total
- container_fs_writes_bytes_total
- container_fs_reads_total
- container_fs_reads_bytes_total
- container_fs_usage_bytes

exporters:
coralogix:
Expand Down Expand Up @@ -359,6 +362,7 @@ opentelemetry-collector-events:
receivers:
- otlp
- prometheus
- prometheus/kube_extra_metrics
- k8s_cluster
logs/kube-events:
exporters:
Expand Down

0 comments on commit 544f9fa

Please sign in to comment.