Loading...

About the k9s cheat sheet

k9s is modal and keyboard-driven, and the two keys that unlock it are colon to jump to a resource type and slash to filter what is on screen. Almost everything else is a single letter acting on the highlighted row — describe, logs, shell, delete.

The mental model is a stack of views. You navigate into a resource, act, and press escape to come back. Once that is in your fingers, moving from a deployment to its pods to a container's logs is a few keystrokes with no command construction at all, which is where the speed advantage over kubectl comes from.

The configuration worth setting early is the refresh rate and the default namespace, plus context switching. A refresh that is too aggressive is noticeable on a large cluster, and pinning frequently used namespaces avoids scrolling past hundreds of pods you do not care about.

Frequently asked questions

How do I switch context or namespace?

Use the colon prompt and type ctx or ns to get a selectable list. This is faster than editing kubeconfig or using kubectl config, and it makes the current context visible in the header at all times — which is worth having when you have production and staging open in different terminals.

How do I see logs from a previous crashed container?

Open logs on the pod and toggle to previous, which shows the last terminated container's output. This is the same information kubectl gives with its previous flag, and it is the only way to see why a CrashLoopBackOff container actually failed rather than watching it fail again.

Can I use k9s with restricted RBAC?

Yes, and it will only show what your credentials permit. Views requiring cluster-scoped list permissions appear empty or error, which is expected rather than a fault. Test with the role you will actually use, since evaluating as cluster-admin gives a misleading impression of what your team will see.

How do I filter to just the pods I care about?

Press slash and type a filter, which accepts regular expressions for anything more complex than a substring. Filters apply to the current view, so combining a namespace switch with a filter narrows a large cluster quickly. Inverse filters are available for excluding noisy workloads.

Does k9s work over SSH?

Yes, and that is one of its main advantages over desktop tools — it is a terminal application, so it runs anywhere you have a shell, including a bastion host where installing a GUI is not an option. Ensure the terminal reports a sensible type and size, since rendering depends on it.