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 last9Auto-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.