Skip to main content

Overview

OpenSRE connects to Kubernetes using a standard kubeconfig. Works with any cluster — GKE, AKS, EKS, on-prem, kind, or minikube — without requiring AWS credentials or cloud-specific tooling.

Prerequisites

  • A kubeconfig file (typically ~/.kube/config) or its raw YAML content
  • Read access to the namespaces you want to investigate (get/list on pods, deployments, events, logs)

Setup

Option 1: Interactive CLI

The wizard will ask for:
  1. kubeconfig — paste the raw kubeconfig YAML, or provide a file path that will be read and stored inline
  2. Context — optional; leave blank to use the kubeconfig’s current context
  3. Default namespace — defaults to default

Option 2: Environment variables

Option 3: Persistent store

Store an active kubernetes record in ~/.opensre/integrations.json with kubeconfig content (or path resolved into content by setup), plus optional context, namespace, and allowed_namespaces list.

Credentials

Namespace allowlist

Namespace-scoped tools accept a namespace argument, so the agent can move between namespaces during an investigation. Which namespaces it can reach is set by the operator:
  • With KUBECONFIG_NAMESPACES unset, the agent can only reach KUBECONFIG_NAMESPACE, the same as before.
  • With KUBECONFIG_NAMESPACES=production,staging, the agent can target either namespace. KUBECONFIG_NAMESPACE is always allowed, and calls that omit a namespace still use it.
  • Any other namespace is refused before the cluster is contacted, with namespace "<name>" is not in the configured allowlist (allowed: ...).
The allowlist is enforced by OpenSRE on top of RBAC and is not a substitute for it. A service account with cluster-wide read access is still limited to the listed namespaces. Cluster-scoped lookups (kubernetes_list_nodes, and kubernetes_get_resource for nodes) are not affected. The kubeconfig’s service account or user needs these Kubernetes RBAC permissions:

Tools

Example: investigating a crash-looping pod

OpenSRE will:
  1. Call kubernetes_list_pods scoped to production to find pods with high restart counts
  2. Call kubernetes_get_pod_logs to read recent container output
  3. Call kubernetes_get_events with involvedObject.name=payments-api to surface Warning events
  4. Correlate the evidence into a root-cause summary

Local verification recipe

Verified all 12 registered tools live against a real local kind cluster with a representative workload — a Deployment, StatefulSet, DaemonSet, Service, Ingress, ConfigMap, and a deliberately crash-looping bare pod.
The bare pod’s apply can fail on the first attempt with error looking up service account demo/default: serviceaccount "default" not found — the Namespace’s default ServiceAccount is created asynchronously by a controller shortly after the Namespace itself, so a Pod in the same kubectl apply batch can race it. Retrying the whole apply (already-created objects are simply reported unchanged) is simpler than adding a separate wait step, and resolves on the very next attempt once the ServiceAccount controller catches up.
opensre integrations verify checks a saved store record before env vars, and chat sessions only fall through to env vars when the store has no records at all — any existing record, for any service, blocks env-var resolution entirely. Point OPENSRE_INTEGRATIONS_STORE_PATH at a path inside a fresh empty directory before verifying, so a real saved record can’t shadow the KUBECONFIG_* vars above, and your real config is never read or written:
Verify:
Now ask the agent about the crash-looping pod:
Ask: Why is the demo-crashloop pod in the demo namespace crash-looping? Against this exact local cluster the agent lists pods, describes demo-crashloop, pulls its events and logs, and finds the hardcoded exit 1 in the container command. All 12 registered tools were confirmed to return real data against this cluster. Teardown:

Verify

A successful verification lists the namespaces visible to the configured credentials. Inside the REPL: /integrations verify kubernetes or /verify kubernetes.

Troubleshooting

Security

  • Prefer a dedicated read-only service account or user for OpenSRE.
  • Store kubeconfig material in the integration store or a secret manager — not in source control.
  • Scope RBAC to the namespaces you want investigated (get / list only).