OpenTelemetry Operator for Kubernetes
OpenTelemetry Operator for Kubernetes
When installing the StackGen Agent onto your Kubernetes cluster, we also give the option to install the OpenTelemetry Operator for Kubernetes.
With the Operator on your cluster, it will auto-instrument your Kubernetes apps by injecting the OpenTelemetry instrumentation libraries into your app container.
This auto-instrumentation (via annotations) allow you enable traces without changing application code.
Auto Instrumenting via the OpenTelemetry Operator
- Install the StackGen Agent (steps here) with the following flag enabled in your
values.yamlfile:
oteloperator:
enabled: true
If you've already installed the agent, please uninstall it first: helm uninstall -n devopsnow devopsnow-agent and then re-install.
The OTel Operator chart installs CRDs, and Helm (out of best practice) only installs CRDs at install time; they are ignored during helm upgrade ...
- After the agent is installed, simply add the following annotation to your Pod (depending on the language of your app):
Java
instrumentation.opentelemetry.io/inject-java: devopsnow/devopsnow-agent-otel-operator-instrumentation
NodeJS
instrumentation.opentelemetry.io/inject-nodejs: devopsnow/devopsnow-agent-otel-operator-instrumentation
Python
instrumentation.opentelemetry.io/inject-python: devopsnow/devopsnow-agent-otel-operator-instrumentation
Only the key changes per language. The value is the same (an Instrumentation spec which was created during Step (1) - pointing to your OpenTelemetry Collector)
For example, a sample NodeJS app may have the following annotation:
apiVersion: apps/v1
kind: Deployment
metadata:
...
spec:
...
template:
metadata:
annotations:
instrumentation.opentelemetry.io/inject-nodejs: "devopsnow/devopsnow-agent-otel-operator-instrumentation"
...
- Once rolled out, you'll begin seeing traces come into
Grafana Exploreunder theTracesdata source. You can also use theAPM Insightsdashboard in Grafana to get high level insights into your application traces.