Skip to content
Last9
Book demo

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.sh
chmod +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"

Verification

kubectl get pods -n last9

Resource 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.name
  • k8s.pod.uid
  • k8s.namespace.name
  • k8s.deployment.name
  • k8s.node.name
  • k8s.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 other k8s.* 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"

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-cluster

Deploy 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.yaml

Uninstall

./last9-otel-setup.sh uninstall-all

Troubleshooting

# Operator not starting
kubectl logs -n opentelemetry-operator-system deployment/opentelemetry-operator-controller-manager
# App not instrumented
kubectl describe pod <your-app-pod> | grep instrumentation.opentelemetry.io
kubectl get instrumentation -n last9 -o yaml
# Collector issues
kubectl logs -n last9 <collector-pod-name> | grep -i error

Please get in touch with us on Discord or Email if you have any questions.