diff --git a/.github/README.md b/.github/README.md index 07020942af..81ef3cc6dc 100644 --- a/.github/README.md +++ b/.github/README.md @@ -48,59 +48,13 @@ The following guide describes how to setup the OpenTelemetry demo with Elastic O #### Kubernetes monitoring -##### Kubernetes infrastructure monitoring - -In `opentelemetry-collector` section uncomment the following to enable the k8s node level monitoring. -This will enable metrics' collection on node level as well as logs collection from Pods. -```yml -mode: "daemonset" -presets: - kubernetesAttributes: - enabled: true - kubeletMetrics: - enabled: true - hostMetrics: - enabled: true - logsCollection: - enabled: true - includeCollectorLogs: false - storeCheckpoints: true -``` - -##### Kubernetes Pod autodiscovery - -Under `config` section enable the `k8s_observer` with the following: - -```yml -extensions: - k8s_observer: - auth_type: serviceAccount - node: ${env:K8S_NODE_NAME} - observe_pods: true -``` - -Then under `receivers` section enable the Redis receiver based on an autodiscovery rule: - -```yml -receiver_creator: - watch_observers: [ k8s_observer ] - receivers: - redis: - rule: type == "port" && pod.name matches "redis" - config: - collection_interval: 2s -``` - -Under `service` section add the `extensions`: - -```yml -extensions: [k8s_observer] -``` - -and register the `receiver_creator` in the `metrics` `receivers` list: -```yml -receivers: [otlp, receiver_creator] -``` +This demo already enables cluster level metrics collection with `clusterMetrics` and +Kubernetes events collection with `kubernetesEvents`. + +In order to add Node level metrics collection and autodiscovery for Redis Pods +we can run an additional Otel collector Daemonset with the following: + +`helm install daemonset open-telemetry/opentelemetry-collector --values daemonset.yaml` ## Explore and analyze the data With Elastic diff --git a/kubernetes/elastic-helm/daemonset.yaml b/kubernetes/elastic-helm/daemonset.yaml new file mode 100644 index 0000000000..b64a5e12ca --- /dev/null +++ b/kubernetes/elastic-helm/daemonset.yaml @@ -0,0 +1,56 @@ +mode: daemonset +presets: + logsCollection: + enabled: true + hostMetrics: + enabled: true + kubeletMetrics: + enabled: true + kubernetesAttributes: + enabled: true + +extraEnvs: + - name: ELASTIC_APM_ENDPOINT + valueFrom: + secretKeyRef: + name: elastic-secret + key: elastic_apm_endpoint + - name: ELASTIC_APM_SECRET_TOKEN + valueFrom: + secretKeyRef: + name: elastic-secret + key: elastic_apm_secret_token + +config: + extensions: + k8s_observer: + auth_type: serviceAccount + node: ${env:K8S_NODE_NAME} + observe_pods: true + exporters: + otlp/elastic: + endpoint: ${ELASTIC_APM_ENDPOINT} + compression: none + headers: + Authorization: Bearer ${ELASTIC_APM_SECRET_TOKEN} + receivers: + receiver_creator: + watch_observers: [ k8s_observer ] + receivers: + redis: + rule: type == "port" && pod.name matches "redis" + config: + collection_interval: 2s + service: + extensions: [k8s_observer] + pipelines: + traces: + processors: [batch] + exporters: [otlp/elastic] + metrics: + receivers: [ receiver_creator] + processors: [batch] + exporters: [otlp/elastic] + logs: + processors: [batch] + exporters: [otlp/elastic] \ No newline at end of file diff --git a/kubernetes/elastic-helm/values.yaml b/kubernetes/elastic-helm/values.yaml index b32f065086..bd06405377 100644 --- a/kubernetes/elastic-helm/values.yaml +++ b/kubernetes/elastic-helm/values.yaml @@ -1,28 +1,13 @@ opentelemetry-collector: -# Uncomment these lines to enable k8s infra monitoring. -# Note that only node level metrics will be collected since cluster level metrics -# require "deployment" mode -# mode: "daemonset" -# presets: -# kubernetesAttributes: -# enabled: true -# kubeletMetrics: -# enabled: true -# hostMetrics: -# enabled: true -# logsCollection: -# enabled: true -# includeCollectorLogs: false -# storeCheckpoints: true -# -# Uncomment these lines to enable k8s cluster level metrics. -# At the moment it cannot be used along with the node level metrics from above. -# mode: "deployment" -# presets: -# kubernetesAttributes: -# enabled: true -# clusterMetrics: -# enabled: true + mode: "deployment" + presets: + kubernetesAttributes: + enabled: true + kubernetesEvents: + enabled: true + clusterMetrics: + enabled: true + extraEnvs: - name: ELASTIC_APM_ENDPOINT valueFrom: @@ -35,14 +20,6 @@ opentelemetry-collector: name: elastic-secret key: elastic_apm_secret_token config: -# k8s_observer section enables the k8s autodiscovery observer -# With this enabled we can automatically enable service specific receivers -# based on conditions -# extensions: -# k8s_observer: -# auth_type: serviceAccount -# node: ${env:K8S_NODE_NAME} -# observe_pods: true exporters: otlp/elastic: endpoint: ${ELASTIC_APM_ENDPOINT} @@ -50,15 +27,6 @@ opentelemetry-collector: headers: Authorization: Bearer ${ELASTIC_APM_SECRET_TOKEN} receivers: -# receiver_creator enables service specific receivers -# based on conditions -# receiver_creator: -# watch_observers: [ k8s_observer ] -# receivers: -# redis: -# rule: type == "port" && pod.name matches "redis" -# config: -# collection_interval: 2s otlp: protocols: grpc: @@ -70,8 +38,6 @@ opentelemetry-collector: - https://* endpoint: ${MY_POD_IP}:4318 service: -# Enable extensions -# extensions: [k8s_observer] pipelines: traces: receivers: [otlp] @@ -79,8 +45,6 @@ opentelemetry-collector: exporters: [otlp/elastic] metrics: receivers: [otlp] -# Add the receiver_creator -# receivers: [otlp, receiver_creator] processors: [batch] exporters: [otlp/elastic] logs: