> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squasher.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Kubernetes

> Collect logs, traces, and workload metrics from Kubernetes with OpenTelemetry Collector.

Collect logs and kubelet workload metrics from every node in your Kubernetes cluster, then inspect pod CPU, memory, and restart signals in Squasher.

## Setup with Helm

### 1. Add the OTel Helm Chart

```bash theme={null}
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update
```

### 2. Create Values File

```yaml theme={null}
# values-squasher.yaml
mode: daemonset

presets:
  logsCollection:
    enabled: true
  kubernetesAttributes:
    enabled: true
  kubeletMetrics:
    enabled: true

config:
  exporters:
    otlphttp/squasher:
      endpoint: https://ingest.squasher.ai
      headers:
        x-squasher-key: "sq_pk_your_api_key"

  service:
    pipelines:
      logs:
        exporters: [otlphttp/squasher]
      traces:
        exporters: [otlphttp/squasher]
      metrics:
        exporters: [otlphttp/squasher]
```

### 3. Install

```bash theme={null}
helm install otel-collector open-telemetry/opentelemetry-collector \
  -f values-squasher.yaml \
  --namespace monitoring \
  --create-namespace
```

All pod logs across the cluster are now collected and forwarded to Squasher.

## What Gets Captured

* **Pod logs** from all namespaces (configurable via `logsCollection.includeCollectorLogs`)
* **Kubernetes metadata** automatically attached: pod name, namespace, node, container, labels
* **Error-level log entries** create error groups with AI triage
* **OTel traces** from instrumented services via gRPC/HTTP receivers
* **Kubelet metrics** for pod and container CPU and memory

The Kubernetes page also displays `k8s.container.restarts` when you export that metric from a separately deployed cluster metrics receiver. Do not run a cluster-wide receiver on every DaemonSet replica, because that produces duplicate cluster metrics.

Open **Kubernetes** in the project navigation to filter reporting pods by cluster, namespace, workload, or pod. The page reads only the selected 1-hour, 6-hour, or 24-hour window and shows the latest value from each metric series.

## Application Instrumentation

For richer error context, instrument your services with OTel SDKs and point them at the collector:

```yaml theme={null}
# deployment.yaml
env:
  - name: OTEL_EXPORTER_OTLP_ENDPOINT
    value: "http://otel-collector.monitoring.svc:4317"
  - name: OTEL_SERVICE_NAME
    value: "my-service"
```

The collector enriches traces with Kubernetes metadata and forwards everything to Squasher.

## Filtering

To collect only error-level logs, add a filter processor:

```yaml theme={null}
# values-squasher.yaml
config:
  processors:
    filter/errors:
      logs:
        log_record:
          - severity_number >= 17 # ERROR and above
  service:
    pipelines:
      logs:
        processors: [filter/errors]
        exporters: [otlphttp/squasher]
```

## Agent handoff

```text theme={null}
Configure Kubernetes telemetry for Squasher project <project_id>. Patch the OpenTelemetry Collector values with the kubernetesAttributes and kubeletMetrics presets, keep secrets out of manifests when possible, export logs, traces, and metrics over OTLP, then verify one pod appears on the Kubernetes page. Ask before changing cluster-wide collection.
```
