Kubernetes ⎈ (kubectl)

Using Gonzo with "kubectl"

Gonzo is a powerful terminal UI log analysis tool that works seamlessly with Kubernetes logs via kubectl. This guide shows you how to monitor and analyze logs from your Kubernetes pods in real-time.

Quick Start

The simplest way to use Gonzo with kubectl is to pipe logs directly:

kubectl logs -f deployment/my-app | gonzo

Monitoring Multiple Pods

To aggregate logs from multiple pods in a namespace, use a simple script like the following, to stream logs with pod identifiers - you can also consider using Stern:

Create multi-pod-logs.sh

#!/bin/bash
for p in $(kubectl get pods -n default -o name); do
  kubectl logs -n default --all-containers -f "$p" | sed "s|^|[$p] |" &
done
wait

Make it executable:

chmod +x multi-pod-logs.sh

Run with Gonzo

./multi-pod-logs.sh | gonzo

This will:

  • Stream logs from all pods in the default namespace

  • Prefix each log line with the pod name

  • Display everything in Gonzo's real-time TUI dashboard

Last updated