This topic describes how to install an OpenTelemetry Collector in Kubernetes to collect infrastructure and application metrics and send them to Cloud Observability. To simplify the configuration of the OpenTelemetry Collector, a StatefulSet is used with the Target Allocator’s PrometheusCRD functionality enabled. This behavior allows the Collector to dynamically discover new jobs.
From the Cloud Observability otel-collector-charts repository, copy the
kube-otel-stack folder to your existing directory.
LS_TOKENto your Cloud Observability access token.
1 export LS_TOKEN=”<ACCESS_TOKEN>”
Disable any Kubernetes Infrastructure Components you do not need
By default, the
values.yaml for the
kube-otel-stack has the following components enabled for scraping:
You can disable any of them by setting
1 2 3 4 kubectl create namespace opentelemetry kubectl create secret generic otel-collector-secret -n opentelemetry --from-literal=LS_TOKEN=$LS_TOKEN helm dependency update helm upgrade lightstep ./charts/kube-otel-stack -f ./charts/kube-otel-stack/values.yaml -n opentelemetry --install
1 kubectl get statefulset -n opentelemetry
Now that you are succesfully scraping Collector, Operator, Target Allocator, and Kubernetes infrastructure metrics, you can use our pre-built dashboards to monitor them. Or you can use the terraform dashboards. If in the future you have applications that emit Prometheus metrics, you can use ServiceMonitors and PodMonitors to scrape them.
Updated Oct 21, 2022