On this page
Connect a Kubernetes cluster
Install the OpenTelemetry Operator and its Collectors in your cluster with one Helm command - what it installs, what it collects, what it is allowed to do, and how to change or remove it.
Turning on the Kubernetes add-on does not collect anything by itself. The Kubernetes pages fill in once a cluster sends its logs, metrics and events. One command, with Helm or plain kubectl, sets that up.
What you need
- A Kubernetes cluster with Linux nodes, and
kubectl1.22 or later pointed at it, plus Helm 3.8 or later if you install with Helm, with permission to create namespaces, cluster roles and custom resource definitions. Cluster admin is the simplest. - The Owner or Admin role in your workspace, to create the ingest key.
- Outbound HTTPS from the cluster to your workspace's ingest address. Nothing connects into the cluster.
Install
- In the app, open Connect Your Data and choose Kubernetes.
- Name the cluster, for example
prod-eu-1: lowercase letters, digits and dashes, at most 63 characters. Every record from the cluster carries this name, and it is how you pick the cluster on the Kubernetes pages. It also names the ingest key and the data input in Sources, with "(Kubernetes)" added, for exampleprod-eu-1 (Kubernetes). - Choose Create ingest key. You can attach a Data Flow to the input in the next step to drop or mask fields before they are stored. This is optional.
- Copy the install command and run it against your cluster. The key is shown only on this page, so copy the command before you leave.
The command looks like this, with your own cluster name and key:
helm upgrade --install obistack-k8s obistack-k8s-monitoring \
--repo 'https://downloads.obistack.com/charts' \
--namespace obistack-system --create-namespace \
--set clusterName='prod-eu-1' \
--set endpoint='https://ingest.obistack.com/ingest/otel' \
--set apiKey='<your ingest key>'
helm upgrade --install is safe to run again: it installs the first time
and updates the release after that.
Keeping the key out of your shell history. The command passes the key on the command line, so it is saved in your shell history and in the Helm release. To avoid that, create the Secret yourself, for example from your secrets manager, and tell the chart to use it instead:
kubectl create namespace obistack-system
kubectl create secret generic obistack-k8s-credentials -n obistack-system \
--from-literal=api-key='<your ingest key>'
helm upgrade --install obistack-k8s obistack-k8s-monitoring \
--repo 'https://downloads.obistack.com/charts' \
--namespace obistack-system \
--set clusterName='prod-eu-1' \
--set endpoint='https://ingest.obistack.com/ingest/otel' \
--set existingSecret=true
Without Helm
Choose kubectl on the install step to get the same install as one
command, using only curl and kubectl:
curl -fsSL -H 'Authorization: Bearer <your ingest key>' \
'https://api.obistack.com/v1/kubernetes/install.yaml?cluster=prod-eu-1&endpoint=https://ingest.obistack.com/ingest/otel' \
| kubectl apply --server-side --force-conflicts -f - \
&& kubectl wait --for=condition=Established --timeout=300s crd/opentelemetrycollectors.opentelemetry.io \
&& kubectl -n obistack-system rollout status deployment/obistack-k8s-opentelemetry-operator --timeout=300s \
&& kubectl -n obistack-system get configmap obistack-k8s-collectors \
-o jsonpath='{.data.collectors\.yaml}' \
| kubectl apply --server-side --force-conflicts --field-manager=obistack-k8s -f -
ObiStack returns the chart's resources as plain YAML, with your cluster
name, endpoint and key filled in and a new certificate for the Operator's
webhook. The key is sent as a header, so it is not written to access logs,
and is only ever placed in the obistack-k8s-credentials Secret. To read
the YAML before applying it, run the curl part on its own and save it to
a file.
Kubernetes cannot create the Collectors in the same apply that defines
their resource type, so the YAML carries them in the
obistack-k8s-collectors ConfigMap. The rest of the command waits for the
Operator to be ready and then creates both Collectors from it. To upgrade,
run the command again.
Check it is working
kubectl get opentelemetrycollectors,pods -n obistack-system
The Operator and both Collectors' pods should reach Running within a
minute or two. The Connect Your Data page waits for the first event and
updates on its own once it arrives. The cluster then appears on the
Kubernetes pages, as long as the add-on is on.
If nothing arrives after a few minutes:
kubectl logs -n obistack-system <collector pod>shows export errors, such as a wrong endpoint or a revoked key.- Check the cluster can reach your ingest address over HTTPS. A network policy or an egress proxy can block it.
What it installs
The chart is a thin wrapper around the OpenTelemetry project's own
opentelemetry-kube-stack
chart. Everything that runs in your cluster is the upstream OpenTelemetry
Operator and the stock OpenTelemetry Collector. In the obistack-system
namespace it creates:
| What | Runs as | Does |
|---|---|---|
| OpenTelemetry Operator | One Deployment | Creates and updates the two Collectors below from their OpenTelemetryCollector resources. |
| Node Collector | A DaemonSet, one pod per node | Pod and container logs; node, pod, container and volume metrics from the kubelet; node host metrics; and an OTLP receiver for instrumented workloads on that node. |
| Cluster Collector | One Deployment | Cluster metrics (pod phases, container restarts and readiness, deployments, StatefulSets, DaemonSets, jobs, autoscalers, node conditions), Kubernetes events, and every 10 minutes the manifests of the cluster's objects. |
| A Secret and a ConfigMap | The ingest key, and the cluster name, endpoint and excluded namespaces the Collectors read. |
Both Collectors add the namespace, node, pod and owning workload to every record, plus the cluster name you chose, and send over OTLP/HTTP to your workspace with your ingest key. The data lands as ordinary logs, metrics and events, so it is searchable in the Log Explorer like everything else you send.
Manifests
From chart version 0.2.0 the cluster Collector lists the cluster's nodes,
namespaces, pods, workloads, services, ingresses, PersistentVolumeClaims,
autoscalers and ConfigMaps every 10 minutes and sends each one's manifest.
They are what the Resources page's Services, Ingresses, Volumes and
ConfigMaps tabs and every YAML tab read. Before anything leaves the cluster
the Collector removes a ConfigMap's data, every object's managedFields,
and the kubectl.kubernetes.io/last-applied-configuration annotation.
Secrets are never listed. Environment variable values in a pod spec are
sent as they are and hidden in the app, so keep secrets in Secrets rather
than in plain env values. To send fewer kinds, or none, override
opentelemetry-kube-stack.collectors.cluster.config.receivers.k8s_objects/obistack-manifests.objects.
Because the Collectors are ordinary custom resources,
kubectl edit opentelemetrycollector can change one without a Helm upgrade.
The next helm upgrade puts the chart's settings back.
Permissions
- The Collectors' cluster roles are read-only:
get,listandwatchon pods, nodes, namespaces, workloads, services, ingresses, volumes, autoscalers, ConfigMaps, events and the kubelet's stats. They cannot change anything in the cluster. - The Operator can manage only the Collector workloads it creates.
- The Operator's webhook certificates are generated by the chart, so cert-manager is not required.
- The node Collector runs as root, because pod log files on a node are readable only by root. It has every Linux capability dropped, cannot escalate privileges and has a read-only root file system. The cluster Collector runs as a non-root user.
To review everything before installing, render the chart without applying
it with helm template and the same values.
Settings
Most installs need only the values the command already sets. Change any of
these with another --set on the same command:
| Setting | Default | Meaning |
|---|---|---|
clusterName | Required | The cluster's name in ObiStack. |
endpoint | Required | Your workspace's OTLP/HTTP address, ending in /ingest/otel. |
apiKey | Empty | The ingest key, stored in the Secret obistack-k8s-credentials. |
existingSecret | false | true when you created that Secret yourself. |
excludeNamespaces | kube-system, kube-public, kube-node-lease | Namespaces whose logs, metrics and traces are not sent. |
opentelemetry-kube-stack.collectors.daemon.presets.logsCollection.enabled | true | Set to false to stop sending pod logs. |
opentelemetry-kube-stack.instrumentation.enabled | false | Set to true to turn on auto-instrumentation. See below. |
The chart's own namespace is always excluded as well, so the Collectors never send their own output back in a loop. Kubernetes events are kept from every namespace, including excluded ones.
To exclude more namespaces, list them all, for example:
--set 'excludeNamespaces={kube-system,kube-public,kube-node-lease,cert-manager}'
Anything else the upstream chart supports can be set under
opentelemetry-kube-stack..
Traces from your workloads
The node Collector on every node accepts OTLP on ports 4317 (gRPC) and 4318 (HTTP), and sends what it receives to your workspace with the same key. A workload already instrumented with OpenTelemetry can send to it instead of to us directly, so the key stays in one place, and its traces and metrics get the same Kubernetes details as everything else.
Auto-instrumentation is off by default, because it changes your pods.
Tick Set up auto-instrumentation on the install step, which adds
--set opentelemetry-kube-stack.instrumentation.enabled=true to the Helm
command or &instrumentation=true to the kubectl one. That creates an
Instrumentation resource named obistack-k8s, and a workload in any
namespace opts in with a pod annotation naming it:
instrumentation.opentelemetry.io/inject-java: "obistack-system/obistack-k8s"
Use inject-nodejs, inject-python or inject-dotnet for those languages.
The annotation goes on the pod template, so the workload has to restart to
pick it up. The Operator then adds the OpenTelemetry SDK for that language to the pod when
it starts. Nothing changes for a workload without the annotation.
Uninstall
helm uninstall obistack-k8s -n obistack-system
If you installed with kubectl, remove the Collectors first so the Operator cleans up their pods, then everything else the install created:
kubectl delete opentelemetrycollectors --all -n obistack-system
kubectl delete namespace,clusterrole,clusterrolebinding,mutatingwebhookconfiguration,validatingwebhookconfiguration \
-l app.kubernetes.io/instance=obistack-k8s
Either way, this removes the Operator and both Collectors. It leaves the Operator's custom resource definitions in place. Once nothing else in the cluster uses the OpenTelemetry Operator, remove them with:
kubectl delete crd opentelemetrycollectors.opentelemetry.io \
instrumentations.opentelemetry.io opampbridges.opentelemetry.io
Revoke the cluster's ingest key from Sources in the app if you no longer need it. Data the cluster already sent stays, within your retention.