|
| 1 | +--- |
| 2 | +title: Kubernetes Monitoring Integration Guide |
| 3 | +description: This guide explains how to monitor Kubernetes clusters using OpenTelemetry and OpenObserve. It covers installing the OpenTelemetry Operator, deploying the OpenObserve Collector, enabling auto-instrumentation, and importing pre-built dashboards. |
| 4 | +--- |
| 5 | + |
| 6 | +# Integration with Kubernetes |
| 7 | + |
| 8 | +This guide provides step-by-step instructions to integrate Kubernetes with **OpenObserve** for observability. |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +Kubernetes monitoring differs from traditional server-based monitoring. Instead of only tracking system uptime, you need insights into **pods, services, microservices interactions, events, logs, and traces**. |
| 13 | + |
| 14 | +OpenTelemetry provides a unified way to collect telemetry data from Kubernetes, and OpenObserve makes it easy to ingest, store, visualize, and analyze that data with minimal setup. |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +The integration includes: |
| 19 | + |
| 20 | +- **Metrics**: CPU, memory, storage, and network usage across nodes and pods |
| 21 | +- **Logs**: Container logs for troubleshooting |
| 22 | +- **Events**: Kubernetes system events with severity levels |
| 23 | +- **Traces**: Auto-instrumented application traces without heavy manual changes |
| 24 | + |
| 25 | +## Steps to Integrate |
| 26 | + |
| 27 | +??? "Prerequisites" |
| 28 | + - A Kubernetes cluster (Minikube, GKE, EKS, or similar) |
| 29 | + - Helm 3.x installed locally |
| 30 | + - `kubectl` configured for your cluster |
| 31 | + - OpenObserve account ([Cloud](https://cloud.openobserve.ai/web/) or [Self-Hosted](../../../quickstart/#self-hosted-installation)) |
| 32 | + |
| 33 | + |
| 34 | +??? "Step 1: Install Cert-Manager" |
| 35 | + |
| 36 | + Cert-Manager manages TLS certificates in Kubernetes and is required by the OpenTelemetry Operator. |
| 37 | + |
| 38 | + ```bash |
| 39 | + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.1/cert-manager.yaml |
| 40 | + ``` |
| 41 | + > Wait about 2 minutes for the webhook to be ready before continuing. |
| 42 | + |
| 43 | + |
| 44 | +??? "Step 2: Add the OpenObserve Helm Repository" |
| 45 | + |
| 46 | + ```bash |
| 47 | + helm repo add openobserve https://charts.openobserve.ai |
| 48 | + helm repo update |
| 49 | + ``` |
| 50 | + |
| 51 | + This makes OpenObserve components available for deployment. |
| 52 | + |
| 53 | + |
| 54 | +??? "Step 3: Install Prometheus Operator CRDs" |
| 55 | + |
| 56 | + These CRDs are required by the OpenTelemetry Operator for metrics collection. |
| 57 | + |
| 58 | + ```bash |
| 59 | + kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml |
| 60 | + kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml |
| 61 | + kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/refs/heads/main/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml |
| 62 | + kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/refs/heads/main/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml |
| 63 | + ``` |
| 64 | + |
| 65 | + |
| 66 | +??? "Step 4: Install the OpenTelemetry Operator" |
| 67 | + |
| 68 | + ```bash |
| 69 | + kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml |
| 70 | + ``` |
| 71 | + |
| 72 | + The operator manages the OpenTelemetry Collector and CRDs for telemetry pipelines. |
| 73 | + |
| 74 | + |
| 75 | +??? "Step 5: Create Namespace for OpenObserve Collector" |
| 76 | + |
| 77 | + ```bash |
| 78 | + kubectl create ns openobserve-collector |
| 79 | + ``` |
| 80 | + |
| 81 | +??? " Step 6: Deploy OpenObserve Collector with Helm" |
| 82 | + |
| 83 | + > Use the **pre-filled command** from OpenObserve (Data Sources section), with your auth token. Go to Data Sources -> Kubernetes -> Copy the command to use. |
| 84 | + |
| 85 | + Install the OpenObserve Collector in your cluster: |
| 86 | + |
| 87 | + ```bash |
| 88 | + helm --namespace openobserve-collector \ |
| 89 | + install o2c openobserve/openobserve-collector \ |
| 90 | + --set k8sCluster=cluster1 \ |
| 91 | + --set exporters."otlphttp/openobserve".endpoint=<O2_ENDPOINT>/api/default \ |
| 92 | + --set exporters."otlphttp/openobserve".headers.Authorization="Basic <BASE64_AUTH>" \ |
| 93 | + --set exporters."otlphttp/openobserve_k8s_events".endpoint=<O2_ENDPOINT>/api/default \ |
| 94 | + --set exporters."otlphttp/openobserve_k8s_events".headers.Authorization="Basic <BASE64_AUTH>" \ |
| 95 | + --create-namespace |
| 96 | + ``` |
| 97 | + |
| 98 | + Replace `<O2_ENDPOINT>` depending on your setup: |
| 99 | + |
| 100 | + | Setup | Endpoint | |
| 101 | + | ----------------- | ---------------------------------------------------------------------------------- | |
| 102 | + | Local OpenObserve | `http://localhost:5080` | |
| 103 | + | In-cluster O2 | `http://<helm-release-name>-openobserve-router.<namespace>.svc.cluster.local:5080` | |
| 104 | + |
| 105 | + This deployment configures the OpenObserve Collector to: |
| 106 | + |
| 107 | + - Collect metrics from your cluster |
| 108 | + - Collect events from your cluster |
| 109 | + - Collect logs from your cluster |
| 110 | + - Enable auto-instrumentation traces |
| 111 | + |
| 112 | +??? "Step 7: Auto-Instrumentation for Traces" |
| 113 | + |
| 114 | + OpenTelemetry supports automatic application instrumentation. Add annotations to your pods or namespaces: |
| 115 | + |
| 116 | + - Java : |
| 117 | + ``` |
| 118 | + instrumentation.opentelemetry.io/inject-java: "openobserve-collector/openobserve-java |
| 119 | + ``` |
| 120 | + - .NET |
| 121 | + ``` |
| 122 | + instrumentation.opentelemetry.io/inject-dotnet: "openobserve-collector/openobserve-dotnet" |
| 123 | + ``` |
| 124 | + - NodeJS |
| 125 | + ``` |
| 126 | + instrumentation.opentelemetry.io/inject-nodejs: "openobserve-collector/openobserve-nodejs" |
| 127 | + ``` |
| 128 | + - Python |
| 129 | + ``` |
| 130 | + instrumentation.opentelemetry.io/inject-python: "openobserve-collector/openobserve-python" |
| 131 | + ``` |
| 132 | + - Go (eBPF) |
| 133 | + ``` |
| 134 | + instrumentation.opentelemetry.io/inject-go: "openobserve-collector/openobserve-go" |
| 135 | + instrumentation.opentelemetry.io/otel-go-auto-target-exe: "/path/to/container/executable" |
| 136 | + ``` |
| 137 | + |
| 138 | +??? "Step 8: Verify logs in OpenObserve" |
| 139 | + |
| 140 | + 1. Go to **Logs** in Openobserve → select **stream** `K8s_events` → set **time range** → **Run Query** to check for EC2 logs. |
| 141 | +  |
| 142 | + 2. Go to **Metrics** section in Stream page, you will find bunch of K8s metrics |
| 143 | +  |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | +!!! tip "Pre-Built Dashboards" |
| 150 | + You can [import dashboards from the OpenObserve community repository](https://github.com/openobserve/dashboards/tree/main/Kubernetes(openobserve-collector)) for quick insights: |
| 151 | + |
| 152 | + * **Namespace (Pods) Dashboard** – resource consumption by pods |
| 153 | + * **Namespaces Dashboard** – cluster-wide resource allocation |
| 154 | + * **Events Dashboard** – system events and severities |
| 155 | + * **Node (Pods) Dashboard** – node-level pod performance |
| 156 | + |
| 157 | +  |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | +## Troubleshooting |
| 162 | + |
| 163 | +**Collector pods not running** |
| 164 | + |
| 165 | +* Check namespace: `kubectl get pods -n openobserve-collector` |
| 166 | +* Review pod logs: `kubectl logs <pod-name> -n openobserve-collector` |
| 167 | + |
| 168 | +**No data in OpenObserve** |
| 169 | + |
| 170 | +* Verify Helm values include the correct OpenObserve URL and auth token |
| 171 | +* Ensure network connectivity from cluster → OpenObserve endpoint |
| 172 | + |
| 173 | +**Auto-instrumentation not working** |
| 174 | + |
| 175 | +* Confirm pod annotations are applied |
| 176 | +* Make sure language-specific auto-instrumentation images are available |
| 177 | + |
0 commit comments