Kubernetes ⎈
Using Gonzo with Kubernetes
Gonzo can now (as of version 0.3.0) natively stream logs from your Kubernetes clusters (using a kubeconfig) — no kubectl logs, no stern, no piping required. This guide covers the essential setup, commands, and filters you need to get started.
Overview
With Kubernetes mode enabled, Gonzo supports:
Direct log streaming from pods
Multiple namespaces at once
Kubernetes label selectors
Automatic namespace + pod columns
Interactive namespace/pod filtering (
Ctrl+k)Real-time updates with reconnection
Prerequisites
Before you begin, ensure:
You have access to a Kubernetes cluster
Your
kubeconfigis validYour account has read access to pod logs
Required RBAC
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: gonzo-log-reader
rules:
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list"]Quick Start
Stream logs from all pods
gonzo --k8s-enabled=trueStart with the last 50 log lines
gonzo --k8s-enabled=true --k8s-tail=50Watch a specific namespace
gonzo --k8s-enabled=true --k8s-namespace=productionWatch multiple namespaces
gonzo --k8s-enabled \
--k8s-namespace=production \
--k8s-namespace=stagingFilter by label selector
gonzo --k8s-enabled --k8s-selector="app=myapp"Set-based selectors
gonzo --k8s-enabled --k8s-selector="environment in (prod,staging)"Common Configuration Options
--k8s-enabled
Enable Kubernetes integration
--k8s-namespace N
Set namespace(s) to watch
--k8s-selector
Kubernetes label selector
--k8s-tail N
Number of historic log lines
--k8s-since N
Only logs newer than N seconds
--k8s-context
Use a specific kube context
--k8s-kubeconfig
Path to kubeconfig file
Example: Namespace + Selector + Tail
gonzo --k8s-enabled \
--k8s-namespace=production \
--k8s-selector="app=api" \
--k8s-tail=100Interactive Filtering (Ctrl+k)
Inside Gonzo, press Ctrl+k to open the Kubernetes filter modal.
You can:
Select namespaces
Select pods
Apply changes instantly
Navigation: ↑/↓ to move • Space to toggle • Enter to apply • ESC to cancel

Kubernetes Display Mode
Gonzo automatically switches into K8s column mode when logs contain Kubernetes attributes.
Time Level Namespace Pod Message
15:04:05 INFO production api-5c44d7f-xkr2p Started worker processPress c to toggle Kubernetes columns on/off.

Example Workflows
Troubleshoot a new deployment
gonzo --k8s-enabled \
--k8s-namespace=production \
--k8s-selector="app=api,version=v2.0.0" \
--k8s-since=300Monitor both staging + prod backend pods
gonzo --k8s-enabled \
--k8s-namespace=production \
--k8s-namespace=staging \
--k8s-selector="tier=backend"Troubleshooting
No logs appear
Verify kubectl access:
kubectl get pods -A
kubectl logs <pod> -n <namespace>Selector not matching
kubectl get pods --selector="app=myapp" -AWrong context
gonzo --k8s-context=my-clusterHigh log volume
Narrow your label selector
Limit historic logs (
--k8s-tail)Limit time window (
--k8s-since)
Best Practices
Start with specific namespaces/selectors
Use Ctrl+k to refine quickly
Toggle columns with c when needed
Save common setups in config files
Use contexts to switch clusters cleanly
Last updated