Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and enhance presets for extra Kubernetes metrics #17

Merged
merged 6 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: opentelemetry-collector
version: 0.63.0
version: 0.64.0
description: OpenTelemetry Collector Helm chart for Kubernetes
type: application
home: https://opentelemetry.io/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
mode: daemonset

presets:
kubeletMetrics:
enabled: true

config:
exporters:
otlp:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
mode: deployment

presets:
kubernetesExtraMetrics:
enabled: true

resources:
limits:
cpu: 100m
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# Source: opentelemetry-collector/templates/clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
app.kubernetes.io/managed-by: Helm
rules:
- apiGroups: [""]
resources: ["pods", "endpoints", "nodes/stats", "nodes/metrics", "nodes", "services"]
verbs: ["get", "watch", "list"]
- nonResourceURLs:
- "/metrics"
verbs: ["get"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# Source: opentelemetry-collector/templates/clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
app.kubernetes.io/managed-by: Helm
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: example-opentelemetry-collector
subjects:
- kind: ServiceAccount
name: example-opentelemetry-collector
namespace: default
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -24,6 +24,12 @@ data:
size_in_percentage: 40
processors:
batch: {}
filter/k8s_node_cadvisor:
metrics:
metric:
- resource.attributes["service.name"] == "kubernetes-cadvisor" and (name !=
"container_fs_writes_total" and name != "container_fs_reads_total" and name
!= "container_fs_writes_bytes_total" and name != "container_fs_reads_bytes_total")
memory_limiter:
check_interval: 5s
limit_percentage: 80
Expand All @@ -37,6 +43,10 @@ data:
endpoint: ${env:MY_POD_IP}:6831
thrift_http:
endpoint: ${env:MY_POD_IP}:14268
kubeletstats:
auth_type: serviceAccount
collection_interval: 20s
endpoint: ${K8S_NODE_NAME}:10250
otlp:
protocols:
grpc:
Expand All @@ -51,6 +61,22 @@ data:
static_configs:
- targets:
- ${env:MY_POD_IP}:8888
prometheus/k8s_node_cadvisor:
config:
scrape_configs:
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
honor_timestamps: true
job_name: kubernetes-cadvisor
kubernetes_sd_configs:
- role: node
metrics_path: /metrics/cadvisor
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
zipkin:
endpoint: ${env:MY_POD_IP}:9411
service:
Expand All @@ -74,9 +100,12 @@ data:
processors:
- memory_limiter
- batch
- filter/k8s_node_cadvisor
receivers:
- otlp
- prometheus
- kubeletstats
- prometheus/k8s_node_cadvisor
traces:
exporters:
- otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -16,10 +16,18 @@ data:
logging: {}
extensions:
health_check: {}
k8s_observer:
auth_type: serviceAccount
observe_pods: true
memory_ballast:
size_in_percentage: 40
processors:
batch: {}
filter/k8s_apiserver:
metrics:
metric:
- resource.attributes["service.name"] == "kubernetes-apiserver" and name !=
"kubernetes_build_info"
memory_limiter:
check_interval: 5s
limit_percentage: 80
Expand Down Expand Up @@ -47,12 +55,40 @@ data:
static_configs:
- targets:
- ${env:MY_POD_IP}:8888
prometheus/k8s_apiserver:
config:
scrape_configs:
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
honor_timestamps: true
job_name: kubernetes-apiserver
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- action: keep
regex: default;kubernetes;https
source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_service_name
- __meta_kubernetes_endpoint_port_name
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
receiver_creator/ksm_prometheus:
receivers:
prometheus_simple:
config:
endpoint: '`endpoint`'
rule: type == "port" && port == 8080 && pod.name contains "kube-state-metrics"
watch_observers:
- k8s_observer
zipkin:
endpoint: ${env:MY_POD_IP}:9411
service:
extensions:
- health_check
- memory_ballast
- k8s_observer
pipelines:
logs:
exporters:
Expand All @@ -68,9 +104,12 @@ data:
processors:
- memory_limiter
- batch
- filter/k8s_apiserver
receivers:
- otlp
- prometheus
- receiver_creator/ksm_prometheus
- prometheus/k8s_apiserver
traces:
exporters:
- logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 13b1c0a193b017fccd42b05742048c8d43d07f5b4df2c70b9078bc3daef46b4b
checksum/config: 18248f4d181db07bec9d1fceea2489c7a62735240e8fbbdd7cd419cc55dd2786

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down Expand Up @@ -73,6 +73,10 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
livenessProbe:
httpGet:
path: /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Deployment
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -23,7 +23,7 @@ spec:
template:
metadata:
annotations:
checksum/config: a1e9d8f628b1ccdcbbfa0aa08e2b3c44fc2cce6c2a4f1fdc546d25a99f22efa2
checksum/config: a50fa52e97fc84b3c4347febf4558f7e5552e3f290477f015d3eaa9a43caf4db

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Service
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 47a843b7fd1e7f8de1cb7e6aad6bfb5aa5f9123511c928241aa1a46d6a3b2ce0
checksum/config: 3ce0c696231e9549c9d9f9e6ede3913fdeba1d216b0c6c69a68f8a1ddaef71d3

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 8257525211973c77e15c376416b8c693e536210f65bd4170993d042795e96004
checksum/config: 50ffd41654a97e19552e9153856db645c6f180e8715358c9dcc268aaca58691e

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: 8257525211973c77e15c376416b8c693e536210f65bd4170993d042795e96004
checksum/config: 50ffd41654a97e19552e9153856db645c6f180e8715358c9dcc268aaca58691e

labels:
app.kubernetes.io/name: opentelemetry-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
labels:
helm.sh/chart: opentelemetry-collector-0.63.0
helm.sh/chart: opentelemetry-collector-0.64.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.77.0"
Expand Down
Loading