Enable read-only mode before opening a production cluster, because ctrl-k deletes resources without asking for confirmation.
Key takeaways
- k9s is a terminal UI that continuously monitors Kubernetes clusters, supports Linux, macOS, and Windows, and is licensed under Apache 2.0.
- Colon commands, regex and label filtering, Pulses, XRay, and live logs help you locate failures faster in unfamiliar clusters.
- ctrl-k deletes resources without asking for confirmation, so enable read-only mode before working on a customer's production cluster.
In k9s, a single key combination is enough to delete resources on a customer's cluster. The official documentation describes ctrl-k as a kill command that does not prompt for confirmation, equivalent to
kubectl delete --now
。
This scenario is familiar. You've just SSH'd into a customer's jump host, you don't yet know which namespace runs what, and the customer's team is waiting for you to explain why a new service keeps restarting.
First
kubectl get
check Pods, then Deployments, then events, verifying names one by one—slow and error-prone. k9s can shorten this troubleshooting process, but precisely because it's fast, you should lock down write permissions before taking any action.
What exactly is k9s
The k9scli.io homepage defines k9s as a terminal UI for working with Kubernetes clusters. The GitHub repository states the goal plainly: to make browsing, observing, and managing applications easier. The tool continuously monitors Kubernetes for changes and provides commands that let you act directly on the resources you're observing.
Fernand Galiana published an article in early 2019 titled "If you K8s, please try K9s…" introducing k9s, with the core idea of using a single tool for both cluster management and diagnostics. k9s is licensed under Apache 2.0, supports Linux, macOS, and Windows, and can be installed via Homebrew, snap, winget, Scoop, Chocolatey, Docker, or
go install
.
For a Forward Deployed Engineer (FDE), the difference lies in the "monitoring" part. kubectl gives you a snapshot at the moment you run the command; k9s gives you an auto-refreshing view. While talking with a customer, you see Pod state changes immediately, without re-running any commands.
Tracking a CrashLoopBackOff Pod in production
Suppose a customer has three clusters: dev, staging, and prod. The payment service in the payments namespace only misbehaves in prod: Pods start, crash, and restart—i.e., CrashLoopBackOff. Below is a step-by-step walkthrough of a diagnosis.
Step 1: Open the tool safely. Type
k9s --readonly
. The README lists this flag; in read-only mode, mutating commands like delete, kill, and edit are disabled. From that moment on, accidentally pressing any key can't cause damage.
Step 2: Pick the right cluster. Type
:ctx
to view the context list, then switch to prod within the tool. This check is simple but often skipped: is the context name on screen really the cluster the customer reported the failure on?
Step 3: Enter the right namespace. Type a colon followed by a resource name (singular, plural, or abbreviation all work), optionally with a namespace, e.g.
:po payments
. The view refreshes automatically, so you can continuously watch the failing Pod's state changes without repeatedly running commands.
Step 4: Filter out the noise. If the namespace has dozens of Pods, filter within the resource view. You can use a regex matching the service name, an inverse regex excluding healthy Pods, a label selector based on app labels, or fuzzy search. The goal is to keep only the Pods that keep restarting.
Step 5: Understand where the Pod sits in the architecture. Open XRay to see the dependency tree: which Deployment created which ReplicaSet, which in turn created which Pod. If you don't yet have the big picture, use Pulses for a cluster overview. The question to ask is: is the failure only on the new ReplicaSet, or are all Pods under this Deployment crashing?
Step 6: Read the logs. Most of your time will be spent here. By default, k9s fetches the last 100 lines and keeps a 1,000-line buffer;
sinceSeconds
setting it to -1 means tailing logs in real time. Focus on the last few lines before each Pod crash. If the service is very chatty, you can raise these values in the config file.
By the end of the diagnosis, you know the cluster, namespace, Deployment, and relevant log lines—and you haven't changed anything in the customer's system.
The risk comes precisely from the convenience itself
A tool that lets you browse quickly also lets you act quickly, and ctrl-k doesn't ask twice. On a test cluster, a slip costs a few seconds to recreate the resource; on a customer's production cluster, it can cost the trust they just handed you.
So read-only mode shouldn't be a habit you have to remember at every launch. k9s's configuration supports read-only globally or per context, and it's off by default. We recommend enabling read-only for every production context from day one, and only opening write access on dev contexts after the customer agrees in writing.
If you need to edit resources in k9s, the installation docs require setting the
EDITOR
or
KUBE_EDITOR
environment variable. Before setting it on a customer's machine, consider whether manual editing is really appropriate. Changes should usually land in the customer's manifests or pipeline, so there's an audit trail.
One more tip: treat k9s as an accelerator for kubectl, not a substitute for understanding Kubernetes. If you can't yet read events or figure out why a Pod is in CrashLoopBackOff, k9s will just get you confused faster.
Learn kubectl first, then speed up
The sensible order is to get comfortable with kubectl for Pods, Deployments, logs, and contexts first, then move to k9s. Once you're up and running, focus on three things: colon commands and
:ctx
, label filtering, and using XRay to understand an unfamiliar cluster's architecture.
The README also mentions Popeye, a cluster health scanner. Worth trying when you need to compile a list of issues to discuss with the customer.
On a resume or in an FDE interview, don't just write "knows k9s." Tell a specific incident story: you entered a production cluster with read-only access, located the failing Pods by label, read live logs, and proposed a fix through the customer's process. Hiring managers want to see that you can diagnose quickly while staying safe.
A customer's cluster is not a playground. Add
--readonly
before opening k9s, then start troubleshooting.
Was this article helpful?
Thanks for your feedback!