Skip to main content

Overview

Proxy for kubectl with token-optimized output. Compacts pod lists, service tables, and log output.

Syntax

rtk kubectl <SUBCOMMAND> [OPTIONS]

Subcommands

rtk kubectl pods

List pods with compact status.
rtk kubectl pods [OPTIONS]
-n, --namespace <name>
string
Kubernetes namespace
-A, --all-namespaces
flag
List pods across all namespaces
Output:
8 pods in default:
✅ web-deploy-abc123 (2/2) [Running 5h]
✅ api-deploy-def456 (1/1) [Running 5h]
🔄 worker-xyz789 (0/1) [CrashLoopBackOff]
... +5 more
Token savings: 75%

rtk kubectl services

List services with compact networking info.
rtk kubectl services [OPTIONS]
Output:
3 services:
web-svc        LoadBalancer  :80 → nodes:30080
api-svc        ClusterIP     :3000
db-svc         ClusterIP     :5432
Token savings: 70%

rtk kubectl logs

Deduplicated pod logs.
rtk kubectl logs <POD> [OPTIONS]
-c, --container <name>
string
Container name (for multi-container pods)
-f, --follow
flag
Follow log output
--tail <n>
number
Number of lines to show
Features:
  • Deduplicates repeated messages
  • Groups similar log patterns
  • Strips k8s metadata
Token savings: 80%

Examples

List Pods in Namespace

rtk kubectl pods -n production

View Pod Logs

rtk kubectl logs web-deploy-abc123 --tail 100

List All Services

rtk kubectl services --all-namespaces

Implementation

Source: src/container.rs

Optimizations

  • Status icons: Running, 🔄 Pending/CrashLoop, ⏹️ Terminated
  • Container ratios: (2/2) instead of full Ready/Total columns
  • Age formatting: 5h instead of verbose duration
  • Port compaction: :80→30080 instead of full notation

Token Savings Summary

CommandStandardRTKSavings
pods~800 tokens~200 tokens75%
services~500 tokens~150 tokens70%
logs~2000 tokens~400 tokens80%