Kubernetes Operator
Deploy OpenTelemetry Operator for automatic instrumentation and observability in Kubernetes clusters
Deploy OpenTelemetry Operator, Collector, and Cluster Monitoring via automated setup script.
Prerequisites
- Kubernetes cluster (v1.19+), kubectl configured, helm 3.9+
- Cluster admin access
- Last9 credentials from the Integrations page
Installation
curl -O https://raw.githubusercontent.com/last9/last9-k8s-observability/main/last9-otel-setup.shchmod +x last9-otel-setup.sh./last9-otel-setup.sh \ endpoint="$last9_otlp_endpoint" \ token="$last9_otlp_auth_header" \ monitoring-endpoint="$last9_remote_write_url" \ username="$last9_remote_write_username" \ password="$last9_remote_write_password"./last9-otel-setup.sh operator-only \ endpoint="$last9_otlp_endpoint" \ token="$last9_otlp_auth_header"./last9-otel-setup.sh logs-only \ endpoint="$last9_otlp_endpoint" \ token="$last9_otlp_auth_header"./last9-otel-setup.sh monitoring-only \ monitoring-endpoint="$last9_remote_write_url" \ username="$last9_remote_write_username" \ password="$last9_remote_write_password"Verification
kubectl get pods -n last9Resource Enrichment
The operator-deployed OpenTelemetry Collector includes the k8sattributes processor with the required RBAC pre-configured. Every span and metric flowing through the collector is automatically stamped with the following resource attributes — no application or manifest changes needed:
k8s.pod.namek8s.pod.uidk8s.namespace.namek8s.deployment.namek8s.node.namek8s.container.name
These power Last9 features that key off pod identity:
- Discover → Services → Infrastructure Metrics — pod-grouped CPU, memory, network, restart, and CPU-throttling panels from cAdvisor + kube-state-metrics
- Discover → Kubernetes — service-to-pod correlation in the resource graph
- Trace filters — filter by
k8s.pod.name,k8s.namespace.name, and otherk8s.*labels
If you ship traces directly from your application to Last9 without going through the operator-managed collector — for example, a self-managed gateway collector, or direct OTLP from the SDK — see the per-language Kubernetes Resource Attributes guide for the Downward API alternative:
Auto-Instrumentation
Add the annotation to your deployment:
annotations: instrumentation.opentelemetry.io/inject-java: "last9/l9-instrumentation"annotations: instrumentation.opentelemetry.io/inject-nodejs: "last9/l9-instrumentation"annotations: instrumentation.opentelemetry.io/inject-python: "last9/l9-instrumentation"annotations: instrumentation.opentelemetry.io/inject-dotnet: "last9/l9-instrumentation"Then restart your deployment:
kubectl rollout restart deployment/my-app -n <namespace>Advanced Configuration
Set environment and cluster name:
./last9-otel-setup.sh \ endpoint="$last9_otlp_endpoint" \ token="$last9_otlp_auth_header" \ monitoring-endpoint="$last9_remote_write_url" \ username="$last9_remote_write_username" \ password="$last9_remote_write_password" \ env=production \ cluster=my-clusterDeploy on tainted nodes:
./last9-otel-setup.sh \ endpoint="$last9_otlp_endpoint" \ token="$last9_otlp_auth_header" \ monitoring-endpoint="$last9_remote_write_url" \ username="$last9_remote_write_username" \ password="$last9_remote_write_password" \ tolerations-file=/absolute/path/to/tolerations.yamlUninstall
./last9-otel-setup.sh uninstall-allTroubleshooting
# Operator not startingkubectl logs -n opentelemetry-operator-system deployment/opentelemetry-operator-controller-manager
# App not instrumentedkubectl describe pod <your-app-pod> | grep instrumentation.opentelemetry.iokubectl get instrumentation -n last9 -o yaml
# Collector issueskubectl logs -n last9 <collector-pod-name> | grep -i errorPlease get in touch with us on Discord or Email if you have any questions.