Skip to content

Kubectl Operations

The kb CLI wraps kubectl’s most common operations behind fzf-powered resource pickers. You can run them from the TUI operations panel or invoke them directly from the shell. Either way, omitting the resource name drops you into an interactive picker.

Show the full kubectl describe output for a pod, deployment, or any resource.

From the TUI: open the operations panel and select Describe › Pod or Describe › Deployment. The CLI prompts you to pick from the current cluster’s resources.

From the shell:

Terminal window
# Interactive — fzf picker selects the resource kind and name
kb k describe
# Direct
kb k describe pod my-pod -n staging
kb k describe deployment my-app -n production

Pass -i to force the fzf picker even when a name is provided:

Terminal window
kb k describe -i

The namespace flag (-n) defaults to default.

Fetch a resource’s manifest in YAML, equivalent to kubectl get <kind> <name> -o yaml.

From the TUI: select YAML › Pod or YAML › Service. The output renders in the operations output panel.

No direct CLI subcommand exists for YAML view; it is a TUI-only operation. The underlying call is kubectl get pod <name> -n <namespace> -o yaml for pods and kubectl get svc <name> -n <namespace> -o yaml for services.

Open a deployment’s manifest in $EDITOR, equivalent to kubectl edit deployment <name>.

From the TUI: select Edit › Deployment. The TUI suspends while your editor runs and resumes when you save and close.

Direct CLI editing is handled by the same editResource function under the hood. The TUI command is the primary interface for this workflow.

Open a shell inside a running pod.

From the TUI: select Exec › Shell. The TUI suspends and hands over your terminal; it resumes when the shell exits.

From the shell:

Terminal window
# Interactive picker
kb exec
# Named pod
kb exec my-pod -n my-namespace
# Specific container and command
kb exec my-pod -n my-namespace -c sidecar --command /bin/bash
# Force picker even when pod name is provided
kb exec -i

The default command is /bin/sh. Use --command to override it. Use -c to target a specific container in a multi-container pod.

Stream or print logs from a pod.

From the TUI: select Logs › Pod. The TUI fetches the last 100 lines and displays them in the output panel (no follow mode in TUI).

From the shell:

Terminal window
# Interactive picker, last 100 lines
kb logs
# Named pod, follow output
kb logs my-pod -n my-namespace --follow
# Specific container, custom tail depth
kb logs my-pod -c app --tail=200
# Force picker
kb logs -i

Flags:

  • -f / --follow — stream new lines as they arrive
  • --tail=N — show only the last N lines (default 100)
  • -c / --container — target a named container
  • -n / --namespace — namespace (default default)

Forward a local port to a pod or service.

Terminal window
# Interactive picker for resource, then prompted for port mapping
kb pf
# Named pod
kb pf pod/my-pod 8080:80
# Named service, specific namespace
kb pf svc/my-svc 9090:9090 -n staging
# Force picker even with resource given
kb pf -i

The resource argument accepts pod/name or svc/name notation. Bare names are treated as pods. If you omit the port mapping, kb pf prompts you for one (e.g. 8080:80).

The command prints Forwarding <ports> -> <target> in <namespace> (Ctrl+C to stop) and blocks until you interrupt it.

All commands share a consistent resolution strategy: if you supply enough arguments and do not pass -i, the command runs directly. Otherwise it opens fzf. This makes both scripted and ad-hoc usage work without separate commands.

The -n / --namespace flag is available on every command and always defaults to default. Pass it explicitly when working across namespaces:

Terminal window
kb logs my-pod -n kube-system --follow
kb exec my-pod -n staging -c app
kb pf svc/my-svc 5432:5432 -n databases