Prev Next

Cloud / K9s Kubernetes clusters management tool Interview questions

Last updated

1. What is K9s? 2. What problems does K9s solve for Kubernetes operators? 3. How do you install K9s? 4. What are the prerequisites for running K9s? 5. How do you start K9s? 6. What is the command mode in K9s? 7. How do you switch Kubernetes contexts in K9s? 8. How do you switch namespaces in K9s? 9. How do you view pod logs in K9s? 10. How do you open a shell in a pod using K9s? 11. How do you filter resources in K9s? 12. How do you view, describe and edit a resource in K9s? 13. How do you delete a resource in K9s? 14. How do you port-forward to a pod in K9s? 15. What is the XRay view in K9s? 16. What is the Pulse view in K9s? 17. What is the Popeye integration in K9s? 18. How do you scale a deployment in K9s? 19. How do you restart a deployment in K9s? 20. How do you sort resource columns in K9s? 21. List the most useful K9s keyboard shortcuts? 22. What is K9s read-only mode? 23. What is the difference between K9s and kubectl? 24. When would you choose K9s over Lens or the Kubernetes Dashboard? 25. Where does K9s store its configuration files? 26. How do you create custom aliases in K9s? 27. How do you configure custom hotkeys in K9s? 28. How do you customize K9s skins? 29. How do you customize table columns using views.yaml? 30. How does K9s show CPU and memory metrics? 31. How do you view custom resources in K9s? 32. How do you debug a CrashLoopBackOff pod using K9s? 33. How do you roll back a deployment using K9s? 34. How do you cordon and drain a node in K9s? 35. How do you trigger a CronJob manually in K9s? 36. How do you save logs and screen dumps in K9s? 37. How do you run K9s with Docker? 38. How does K9s benchmark a service? 39. Explain the internal working of K9s? 40. How does K9s authenticate with a cluster? 41. Explain the execution flow of a K9s plugin? 42. How do you build a K9s plugin that launches a debug container? 43. How are per-cluster settings stored in K9s? 44. How do you protect production clusters when using K9s? 45. How can you optimize K9s performance on large clusters? 46. How do you troubleshoot K9s failing to connect to a cluster? 47. How do you troubleshoot missing CPU and memory values in K9s? 48. How do you troubleshoot K9s display and rendering problems? 49. How do you investigate a Pending pod in K9s? 50. How do you find why a Service has no endpoints in K9s?

1. What is K9s?

K9s is an open-source, terminal-based UI for navigating, observing and managing Kubernetes clusters. It keeps watching the cluster and redraws resource tables as things change, so pod restarts, rollouts and failures show up live instead of needing another kubectl get.

It is written in Go by Fernand Galiana (the derailed GitHub project), released under Apache 2.0, and reads the same kubeconfig that kubectl uses. Whatever your credentials allow you to do, you can do from K9s - and nothing more.

From the keyboard you can browse any resource type, tail logs, open shells, port-forward, edit manifests, scale, restart and delete.

Take quiz
How does K9s decide which clusters and actions you are allowed to use?
It requires a cluster-admin ServiceAccount created at install time
It reads your existing kubeconfig and uses your credentials
It needs its own login server installed in the cluster
What is the main advantage of K9s over re-running kubectl get again and again?
Live-updating resource views in the terminal
It replaces the Kubernetes API server
It stores cluster state in a local database

2. What problems does K9s solve for Kubernetes operators?

K9s removes the typing and context-juggling that make day-to-day kubectl work slow: long commands, generated pod names, repeated -n flags and constant re-running to see whether something changed.

  1. Name handling - pods like web-7d9f8b6c5-x2k4q are selected with the arrow keys, not copied and pasted.
  2. Live state - tables refresh on their own, so a crash loop or rollout is visible as it happens.
  3. Fast pivots - from a Deployment to its pods, containers, logs and a shell in a few key presses.
  4. Discoverability - the header always lists the shortcuts valid for the current view.

It does not replace kubectl for scripting, but it is much faster for interactive investigation.

Take quiz
Why is K9s convenient for pods named like web-7d9f8b6c5-x2k4q?
It disables name generation in ReplicaSets
It renames pods to short readable names
You select the row and press a key instead of typing the name
What does the menu at the top of a K9s view help with?
Selecting the Kubernetes version to upgrade to
Discovering shortcuts valid for the current view
Choosing the container image tag

3. How do you install K9s?

Install K9s with your platform's package manager, a release binary, or go install. It ships as a single binary, so there is nothing to deploy into the cluster.

# macOS / Linux (Homebrew)
brew install derailed/k9s/k9s

# Windows
winget install k9s
scoop install k9s
choco install k9s

# Linux distributions
sudo snap install k9s --devmode
sudo pacman -S k9s
sudo dnf install k9s

# From source (installs the dev version)
go install github.com/derailed/k9s@latest

Binaries for Linux, macOS and Windows are also published as tarballs on the GitHub releases page, and a container image (derailed/k9s) exists for running it in Docker. Verify the install with k9s version.

Take quiz
Which command installs K9s with Homebrew?
brew install derailed/k9s/k9s
brew cask install k9s-cli
npm install -g k9s
Which install route needs a Go toolchain on your machine?
winget install k9s
sudo snap install k9s --devmode
go install github.com/derailed/k9s@latest

4. What are the prerequisites for running K9s?

K9s needs a working kubeconfig that points to a reachable cluster, plus a terminal that can draw it properly. Everything else is optional but makes specific features work.

  • kubeconfig - default ~/.kube/config or the path in KUBECONFIG, with valid credentials.
  • 256-color terminal - set TERM=xterm-256color on *nix systems if colors look wrong.
  • EDITOR - the environment variable K9s uses when you edit a manifest.
  • metrics-server - required for CPU and memory columns.
  • RBAC permissions - K9s can only list and act on what your user may.
Take quiz
Which environment variable decides which editor opens when you edit a manifest in K9s?
K9S_PAGER
EDITOR
KUBECONFIG
Which cluster add-on must be running for CPU and memory columns to show values?
metrics-server
Cluster Autoscaler
An ingress controller

5. How do you start K9s?

Run k9s in a terminal and it opens on the pods view of your current context and namespace. Flags let you start somewhere more specific.

k9s                           # current context and namespace
k9s -n payments               # start in a namespace
k9s --context prod-eu         # start in a given context
k9s --kubeconfig ~/kube/dev   # use another kubeconfig file
k9s -c deployments            # open directly on a resource view
k9s --readonly                # disable modifying actions
k9s -l debug                  # verbose logging

Use :q or Ctrl-c to leave.

Take quiz
Which flag starts K9s with all modifying actions disabled?
--dry-run
--safe-mode
--readonly
Which flag opens K9s directly in a named kubeconfig context?
--target
--context
--profile

6. What is the command mode in K9s?

Command mode is the : prompt that lets you jump to any resource view by typing its name, short name or a custom alias. Press :, type the alias, press Enter; Tab auto-completes and Esc cancels.

Command Opens
:po or :pod Pods
:dp Deployments
:svc Services
:no Nodes
:ns Namespaces
:ctx Kubernetes contexts
:q Quits K9s

It is separate from the / prompt, which filters the rows of the view you are already in. Ctrl-a lists every alias available in your cluster.

Take quiz
What does typing :dp in K9s do?
Opens the Deployments view
Opens a Docker prompt
Deletes the selected pod
Which key combination lists every alias K9s knows?
Ctrl-x
Ctrl-q
Ctrl-a

7. How do you switch Kubernetes contexts in K9s?

Type :ctx to list all contexts from your kubeconfig, move to one with the arrow keys and press Enter. To skip the list, use :ctx staging to jump straight to a context named staging.

After the switch, K9s reconnects and reopens the view and namespace you last used in that context, because those preferences are stored per context.

The header always shows the active context, so check it before running anything destructive. You can also pick one at launch with k9s --context staging.

Take quiz
Which command jumps straight to a context called staging?
:cluster switch staging
:ctx staging
:use staging
Where does the list of contexts shown by :ctx come from?
Your kubeconfig file(s)
A ConfigMap named contexts in kube-system
A file baked into the K9s container image

8. How do you switch namespaces in K9s?

Open the :ns view, highlight a namespace and press Enter - K9s switches to it and shows its pods. There are faster routes for namespaces you use often.

  • 0 shows resources from all namespaces.
  • Other number keys jump to your favorite namespaces, listed in the header.
  • k9s -n payments starts directly in a namespace.

Favorites are remembered per context, so each cluster can have its own shortlist.

If a namespace you expect is missing from the list, your RBAC probably forbids listing namespaces. You can still start in a known one with -n and K9s works fine inside it.

Take quiz
Which number key shows resources from all namespaces?
9
5
0
What happens when you press Enter on a namespace in the :ns view?
A shell opens inside the namespace
K9s switches to that namespace and shows its pods
The namespace is deleted

9. How do you view pod logs in K9s?

Select a pod (or container) and press l. The log view streams output live; for multi-container pods you can pick a container or view all of them.

Handy keys inside the log view:

  • s - toggle autoscroll
  • w - toggle line wrapping
  • t - toggle timestamps
  • f - full screen
  • p - logs of the previous container instance
  • / - filter lines with a pattern
  • Ctrl-s - save logs to a file

It is the equivalent of kubectl logs -f with the toggles one keypress away.

Take quiz
Which key shows logs from the previous (crashed) container instance?
p
r
k
Which key toggles timestamps in the log view?
x
h
t

10. How do you open a shell in a pod using K9s?

Highlight a pod or container and press s. K9s runs an interactive shell inside it, like kubectl exec -it. For multi-container pods, press Enter on the pod first and choose the container, then press s. Press a to attach to the main process instead.

This only works if the image contains a shell such as /bin/sh. Distroless and scratch-based images fail here, and you need an ephemeral debug container instead (see the debug plugin question).

On a node view the same key launches a helper pod on that node, if node shell is enabled.

Take quiz
Which key opens an interactive shell in the selected container?
w
s
o
What commonly breaks shell access on distroless images?
The image has no shell binary to launch
Shell access needs a LoadBalancer service
K9s only supports Alpine-based images

11. How do you filter resources in K9s?

Press / and type a pattern; the table narrows to matching rows as you press Enter. By default the text is treated as a regular expression. Esc clears the filter.

Input Effect
/api rows whose text matches api
/!kube inverse match - hide rows matching kube
/-l app=api filter by label selector
/-f chkout fuzzy match

The filter sticks to the view while you stay in it, which makes it ideal for narrowing 300 pods down to a single deployment's replicas.

Take quiz
Which input shows only pods labeled app=api?
/@app=api
/-n app=api
/-l app=api
What does the /-f prefix do?
Forces a refresh of the table
Fuzzy-matches the text you type
Follows the logs of the match

12. How do you view, describe and edit a resource in K9s?

Select the resource and use one key per action - each corresponds to a familiar kubectl command.

Key Action kubectl equivalent
d describe, including events kubectl describe
y show the live YAML kubectl get -o yaml
e edit in your $EDITOR kubectl edit
x decode values (Secrets view) base64 -d

Saving and closing the editor applies the change to the cluster. Edit is disabled in read-only mode, and Enter drills down to related resources while Esc steps back.

d is the best first stop when a pod misbehaves, because the Events section sits at the bottom of its output.

Take quiz
Which key shows the live YAML manifest of the selected resource?
y
m
g
Which key decodes values in the Secrets view?
u
k
x

13. How do you delete a resource in K9s?

Select the resource and press Ctrl-d. K9s opens a confirmation dialog (Tab moves between the buttons, Enter confirms) with options such as cascade and force. Use Space to mark several rows first if you want a bulk delete.

Ctrl-k is the harsher sibling: it kills the resource immediately with no confirmation dialog. That is useful for a stuck pod and dangerous everywhere else.

Both actions are blocked in read-only mode, and both are still subject to your RBAC permissions.

Take quiz
Which shortcut removes a resource immediately, with no confirmation dialog?
Ctrl-d
Ctrl-k
Ctrl-x
How do you select several pods before a bulk delete?
Mark the rows with the Space key
Type their names separated by commas into the filter
Open the :bulk view

14. How do you port-forward to a pod in K9s?

Select the pod, container or service and press Shift-F. A dialog asks for the container port and the local port; confirm and K9s opens the tunnel, like kubectl port-forward.

Open :pf to see all active forwards and stop one with Ctrl-d. By default the local side binds to localhost; change it with the portForwardAddress setting or the K9S_DEFAULT_PF_ADDRESS environment variable.

Forwards live only as long as the K9s session, so quitting K9s closes them.

A common use is reaching an internal database or admin UI for a quick check, for example forwarding a pod's port 5432 to local port 15432 and pointing a client at localhost:15432.

Take quiz
Which view lists the active port-forwards?
:fwd
:tunnel
:pf
How can you bind forwards to an address other than localhost?
Edit the pod's hostPort field
Set portForwardAddress or K9S_DEFAULT_PF_ADDRESS
Annotate the service with k9s/bind

15. What is the XRay view in K9s?

XRay is a tree view that shows a workload together with the objects it depends on or owns. Run :xray RESOURCE [NAMESPACE], where the resource can be po, svc, dp, rs, sts or ds.

:xray dp
:xray svc prod

For a Deployment you see the chain Deployment, ReplicaSet, Pod and containers, along with referenced ConfigMaps, Secrets and ServiceAccounts, each flagged OK or faulty. It answers "what is wired to what, and what is broken" without opening five separate views.

Take quiz
What does XRay show for a Deployment?
A tree of related objects such as ReplicaSets, Pods and referenced ConfigMaps or Secrets
A packet capture of its traffic
A heat map of node CPU only
Which command opens XRay for Services?
:scan svc
:trace svc
:xray svc

16. What is the Pulse view in K9s?

Pulse is a cluster-wide dashboard. Open it with :pulses (or pu) to see live counts and small charts for core resources such as Pods, Deployments, ReplicaSets, StatefulSets, DaemonSets, Jobs, Nodes and Events, split into healthy and faulty.

It is the quickest answer to "is anything on fire right now?". A spike in the fault line for Pods or Jobs tells you where to drill next, using the regular views.

Pulse reports what is happening; it does not score your configuration. For that, K9s has the Popeye view.

Take quiz
Which view gives a live cluster-wide dashboard of resource counts and faults?
:wide
:pulses
:header
Pulse is best described as...
A live summary of resource counts and faults across the cluster
A manifest linter that scores misconfigurations
A load generator for services

17. What is the Popeye integration in K9s?

Popeye is a Kubernetes cluster sanitizer, and K9s embeds it. Type :popeye (or pop) to run a scan and see a score with a list of findings per resource type, such as missing probes, absent resource limits or unused ConfigMaps.

Popeye only reads the cluster; it never changes anything. You can tune which checks run and their thresholds through a spinach file. In K9s, a cluster-specific file named <context>_spinach.yml in the config directory gives each context its own rules.

Take quiz
Which command launches the cluster sanitizer inside K9s?
:pulses
:xray
:popeye
What does a per-context spinach file customize?
The K9s skin colors
Which sanitizer checks run and their thresholds for that cluster
The port-forward bind address

18. How do you scale a deployment in K9s?

Highlight the Deployment (or StatefulSet or ReplicaSet) and press s. A small dialog asks for the new replica count; confirm and K9s patches the scale subresource - the same as kubectl scale.

One caveat: if a HorizontalPodAutoscaler manages the workload, it will push the replica count back to what it calculates, so your manual number may not stick. Scale in read-only mode is disabled.

Scaling to 0 is allowed and is a quick way to pause a workload without deleting it. Open the same dialog later to bring it back.

Take quiz
Which key opens the scale dialog on a Deployment?
s
z
r
Why might a replica count you set revert a minute later?
Scaling in K9s edits only your local kubeconfig
K9s keeps scale changes for only 60 seconds
A HorizontalPodAutoscaler is managing the Deployment

19. How do you restart a deployment in K9s?

Select the Deployment, DaemonSet or StatefulSet and press r. This triggers a rolling restart, equivalent to kubectl rollout restart.

Under the hood the pod template gets a new kubectl.kubernetes.io/restartedAt annotation. That counts as a template change, so the controller replaces pods gradually according to its update strategy and your readiness probes.

This is safer than deleting pods by hand, because the rollout respects maxUnavailable and keeps the service up.

Use it after changing a ConfigMap or Secret that your application reads only at startup, so the new pods pick up the updated values.

Take quiz
What does pressing r on a Deployment do?
Rolls back to the previous revision
Triggers a rolling restart of its pods
Reloads the K9s configuration
How does a rolling restart force new pods to be created?
By changing an annotation in the pod template
By draining every node
By deleting the ReplicaSet's selector

20. How do you sort resource columns in K9s?

Use Shift plus a letter that matches the column: Shift-N sorts by name, Shift-A by age and, in the pods view, Shift-C by CPU and Shift-M by memory. Press the same combination again to reverse the order.

The header menu shows the sort keys available for the current view. To change the default sort for a resource permanently, set sortColumn in views.yaml. Ctrl-w toggles wide columns when you need extra detail.

Sorting by CPU or memory in the pods view is a fast way to find the noisiest pod, and sorting by age groups recently created or restarted pods together.

Take quiz
Which key combination sorts a table by age?
Shift-G
Shift-Z
Shift-A
What happens when you press the same sort key twice?
The view is exported to CSV
The sort order reverses
The column is hidden

21. List the most useful K9s keyboard shortcuts?

These are the keys you will use in nearly every K9s session. Press ? at any time for the full list for your current view.

Key Action
? help and shortcuts
: command mode (jump to a resource)
/ filter the current view
Esc back or cancel
Enter drill into the selected resource
d / y / e describe / YAML / edit
l / s logs / shell
Shift-F port-forward
Ctrl-d / Ctrl-k delete / kill
Space mark a row
:q or Ctrl-c quit

Take quiz
Which key shows all shortcuts for the current view?
?
F1
Ctrl-h
Which input quits K9s?
Only Ctrl-z
q followed by !
:q or Ctrl-c

22. What is K9s read-only mode?

Read-only mode turns off the actions that change the cluster - edit, delete, kill, scale, restart and similar - while leaving browsing, describe, YAML and logs fully usable. It is meant for safe exploration of sensitive clusters.

Enable it per session with k9s --readonly, or permanently with readOnly: true in the configuration. A --write flag can override a configured default for one session.

Note that this is a client-side guard, not a security boundary. A user with write permissions can still use kubectl, so real protection comes from RBAC.

Take quiz
Which statement about read-only mode is correct?
It removes the need for RBAC on the cluster
It disables modifying actions such as delete, edit and scale on the client side
It hides the logs and YAML views
How do you start K9s in read-only mode for one session?
k9s --readonly
k9s -r off
k9s --no-write-mode

23. What is the difference between K9s and kubectl?

Both talk to the same Kubernetes API with the same kubeconfig, but they target different jobs: kubectl is a scriptable, one-shot command-line client, while K9s is an interactive, continuously updating terminal UI.

Aspect kubectl K9s
Interaction one command, one result persistent interactive session
Updates manual re-run or --watch live refresh
Scripting / CI excellent not suitable
Exploration long commands, copied names keyboard navigation and drill-down
Manifests (apply) first-class edit in place only

Most engineers use both: K9s to investigate, kubectl to automate and apply.

Take quiz
Which tool fits CI pipeline automation better?
K9s, because it exports JSON by default
K9s, because it needs no credentials
kubectl, because it is scriptable and non-interactive
What do K9s and kubectl have in common?
The same plugin directory
The kubeconfig and access to the Kubernetes API
Identical keyboard shortcuts

24. When would you choose K9s over Lens or the Kubernetes Dashboard?

Choose K9s when you work in a terminal, over SSH or on a jump host, or when speed matters more than visuals. It starts instantly, needs no GUI, and everything is reachable from the keyboard.

K9s Lens / web dashboard
Runs as terminal binary desktop app (Lens) or in-cluster web UI
Remote servers works over plain SSH needs a display or a network route
Footprint small, single binary heavier, installed or deployed
Visual graphs basic charts (Pulse) richer dashboards

A GUI is nicer for onboarding or for presenting cluster state to non-terminal users; K9s wins for fast daily operations.

Take quiz
Why does K9s suit SSH sessions on jump hosts?
It runs entirely inside the terminal
It installs an agent on the host
It tunnels a browser over SSH automatically
Lens is mainly a...
Helm chart repository
terminal UI plugin for tmux
desktop GUI application

25. Where does K9s store its configuration files?

K9s follows the XDG convention, so the config directory depends on your OS. Run k9s info to print the exact paths on your machine, including logs and screen dumps.

OS Default config directory
Linux / Unix ~/.config/k9s
macOS ~/Library/Application Support/k9s
Windows %LOCALAPPDATA%\k9s

Inside you will find config.yaml, plus optional aliases.yaml, hotkeys.yaml, plugins.yaml, views.yaml and a skins/ folder. Set K9S_CONFIG_DIR to point K9s at a different directory, for example a dotfiles repo.

Keeping this directory in version control lets a whole team share the same aliases, hotkeys and plugins.

Take quiz
Which command prints the locations of K9s config and log files?
k9s --where
k9s info
k9s paths
Which environment variable relocates the K9s config directory?
K9S_CONFIG_DIR
KUBECONFIG
K9S_HOME_DIR

26. How do you create custom aliases in K9s?

Define them in aliases.yaml in the config directory. Each entry maps a short name you type after : to a Kubernetes resource written as group/version/resource.

aliases:
  pp: v1/pods
  dep: apps/v1/deployments
  sec: v1/secrets
  cert: cert-manager.io/v1/certificates

After restarting K9s, :pp opens pods and :cert opens cert-manager certificates. Press Ctrl-a to see built-in and custom aliases together, which is also the quickest way to find the right resource name for a CRD.

Aliases are plain lookups, so you can add as many as you like; they never change anything in the cluster.

Take quiz
In aliases.yaml, what does the entry pp: v1/pods achieve?
Every pod is renamed to pp
Port 1 is forwarded to pods
You can type :pp to open the pods view
Where can you see all active aliases while using K9s?
Open the Popeye report
Press Ctrl-a
Run kubectl get aliases

27. How do you configure custom hotkeys in K9s?

Add entries to hotkeys.yaml. Each hotkey binds a key combination to a command that opens a resource view, so a favorite screen is one keystroke away.

hotKeys:
  shift-0:
    shortCut:    Shift-0
    description: Viewing pods
    command:     pods
  shift-1:
    shortCut:    Shift-1
    description: View deployments
    command:     dp
    keepHistory: true

Pick combinations that do not clash with built-in shortcuts. keepHistory lets you step back with Esc through the views you passed through.

Reserve hotkeys for views you open dozens of times a day, such as a CRD you manage or a deployments list you check after every release.

Take quiz
What does hotkeys.yaml define?
Custom shortcuts that jump to resource views
RBAC rules for K9s users
Colors for headers and borders
What should you avoid when choosing a hotkey combination?
Using the Shift modifier
Writing a description longer than one word
One already used by a built-in K9s shortcut

28. How do you customize K9s skins?

A skin is a YAML file in the skins/ folder of the config directory that sets colors for the body, frame, tables, logs, YAML view and more. Activate it by name under ui.skin in config.yaml.

# ~/.config/k9s/skins/prod-red.yaml
k9s:
  body:
    logoColor: red
  frame:
    border:
      fgColor: red
      focusColor: red

# ~/.config/k9s/config.yaml
k9s:
  ui:
    skin: prod-red

Recent versions can also apply a skin per context, so a red skin on production becomes an instant visual warning. Skins generally look best in a true-color terminal.

Because skins are plain files, teams often commit them to a shared dotfiles repository.

Take quiz
Where is the active skin selected?
In aliases.yaml
Under ui.skin in config.yaml
In the kubeconfig file
Why do many teams use a red skin for production contexts?
It is a visual cue that you are on production
Red skins disable write actions automatically
It makes the UI render faster

29. How do you customize table columns using views.yaml?

views.yaml lets you choose which columns a resource table shows, their order and the default sort. Entries are keyed by the resource's group/version/name, and column names match the headers you see in K9s.

views:
  v1/pods:
    sortColumn: AGE:desc
    columns:
      - NAME
      - STATUS
      - READY
      - RESTARTS
      - IP
      - NODE
      - AGE

This is how you drop noisy columns on small terminals, or surface NODE and IP permanently without pressing Ctrl-w for wide mode every time.

Restart K9s to pick up changes to the file.

Take quiz
What does views.yaml customize?
Which clusters appear in :ctx
Plugin shortcuts and scopes
The columns shown for a resource and its default sort
Under which key do you configure the pods table in views.yaml?
pods.k8s.io/v2
v1/pods
kind: Pod

30. How does K9s show CPU and memory metrics?

K9s reads live usage from the Kubernetes Metrics API served by metrics-server - the same source kubectl top uses. If kubectl top pods works, the CPU and MEM columns in K9s will too.

Besides raw values, the pod view includes percentage columns such as %CPU/R and %CPU/L (usage against requests and limits), and similar memory columns. They make over-provisioned or throttled pods easy to spot.

Row colors change when values cross configurable thresholds, and without metrics-server the columns simply show as unavailable.

Take quiz
What do the %CPU/R and %CPU/L columns compare?
Current CPU usage against the pod's requests and limits
Requests against limits only
Node CPU against cluster capacity
Where does K9s get live usage figures?
Prometheus on port 9090 by default
Each container's /proc over SSH
The Metrics API served by metrics-server

31. How do you view custom resources in K9s?

Use :crd to list every CustomResourceDefinition, then press Enter on one to see its instances. You can also type the resource's plural name or short name directly after :, for example :certificates.

This works because K9s discovers available resources from the API server at startup, so CRDs installed by operators appear without extra configuration. Press Ctrl-a to see which names are available, or add your own in aliases.yaml.

Describe, YAML and edit work on custom resources like any built-in kind.

Take quiz
Which view lists CustomResourceDefinitions?
:custom
:crd
:operators
Why can K9s open custom resources by name without extra setup?
It discovers resources from the API server
It ships a hard-coded list of popular CRDs
Names are generated from the kubeconfig

32. How do you debug a CrashLoopBackOff pod using K9s?

Work from the pod view downwards and let K9s collect the evidence in a few keystrokes.

  1. Open :po and filter to the pod with /. Note the STATUS and RESTARTS columns.
  2. Press d and read Last State, the exit code and the Events at the bottom. Exit code 137 usually means the container was killed, commonly OOMKilled.
  3. Press l, then p to read the logs of the previous instance - the current one may be too young to show the error.
  4. Press y to check probes, resource limits, env vars and mounted ConfigMaps or Secrets.

Typical culprits are a bad command, a missing config value, an overly strict liveness probe or a memory limit that is too low.

Take quiz
An exit code of 137 in describe output usually indicates what?
The readiness probe passed
The image was pulled successfully
The container was killed, commonly OOMKilled
Where in the pod describe output do you see why the previous run ended?
In the Labels section
In Last State and the Events section
In the Tolerations section

33. How do you roll back a deployment using K9s?

K9s rolls back through ReplicaSets. Select the Deployment and press z to list its ReplicaSets, one per revision. Highlight the older revision you want and press Ctrl-l, then confirm.

The effect matches kubectl rollout undo: the Deployment's pod template is set back to that revision's template and a fresh rollout starts, still honoring the rolling-update strategy.

Check the pods afterwards with :po or :xray dp. Remember that a rollback only reverts the template, not configuration held in ConfigMaps or Secrets.

Take quiz
Which view hosts the rollback action in K9s?
The ReplicaSet view
The Node view
The Events view
Which key lists a Deployment's ReplicaSets?
y
r
z

34. How do you cordon and drain a node in K9s?

Open the node list with :no and highlight the node. The Node view offers cordon, uncordon and drain actions; press ? to see the exact keys for your K9s version.

Cordon marks the node unschedulable but leaves existing pods running. Drain cordons and then evicts pods, honoring PodDisruptionBudgets. The drain dialog exposes options similar to the kubectl flags, such as grace period, ignoring DaemonSets, deleting emptyDir data and force.

Press Enter on a node to list the pods running on it, which is a good pre-drain check.

Take quiz
What does cordoning a node do?
Evicts every pod immediately
Marks it unschedulable without evicting existing pods
Deletes the Node object
Which view contains the cordon and drain actions?
The Nodes view (:no)
The PersistentVolumes view (:pv)
The Events view (:ev)

35. How do you trigger a CronJob manually in K9s?

Open :cj, highlight the CronJob and press t. K9s creates a new Job from the CronJob's job template right away, regardless of the schedule.

The Job gets a generated name, so manual runs are easy to tell apart from scheduled ones in the :job view.

This is the same as kubectl create job manual-run --from=cronjob/NAME. It is handy for testing a new job spec or re-running a failed nightly task without waiting.

Jump to :job afterwards, then use l on the pod it created to follow the output.

Take quiz
What does pressing t create in the CronJob view?
A copy of the CronJob with a new schedule
A bare Pod with no owner
A new Job built from the CronJob's template
Which kubectl command is equivalent?
kubectl rollout restart cronjob/CRON
kubectl create job NAME --from=cronjob/CRON
kubectl run --cron NAME

36. How do you save logs and screen dumps in K9s?

Inside a log view press Ctrl-s to write the current log buffer to a file. In any table view Ctrl-s saves what is on screen, such as a pod list, as a dump.

List everything saved so far with :screendump (or :sd). The directory is shown by k9s info and can be changed with the screenDumpDir setting.

This is a quick way to attach evidence to an incident ticket without leaving K9s.

Because dumps are plain files, you can also compare two snapshots taken before and after a change.

Take quiz
Which command lists saved screen dumps?
:screendump
:save
:export
Which key saves the log view to a file?
Ctrl-d
Ctrl-w
Ctrl-s

37. How do you run K9s with Docker?

Run the published image and mount your kubeconfig so K9s can read the cluster credentials.

docker run --rm -it \
  -v ~/.kube/config:/root/.kube/config \
  derailed/k9s

Two gotchas show up often. First, kubeconfigs that rely on exec plugins (for example aws eks get-token) fail because the plugin binary is not in the image. Second, a cluster at 127.0.0.1 such as kind or minikube is unreachable from inside the container unless you use host networking.

For those cases, installing the binary locally is simpler.

Take quiz
Why do you mount the kubeconfig into the K9s container?
To expose port 8080
So K9s inside the container can read cluster credentials
To store the host's log files
Which problem hits kubeconfigs that use the aws exec plugin?
The plugin binary is not present in the image
K9s refuses exec plugins by design
Docker blocks all TLS traffic

38. How does K9s benchmark a service?

K9s has a built-in HTTP load generator based on the hey tool. You first create a port-forward with Shift-F to the pod or service, open :pf, select the forward and press b to start the benchmark.

Results show requests per second, latency percentiles and status codes. Settings live in a benchmarks.yaml under the cluster or context config directory, where you can define concurrency, total requests, HTTP method, path, headers and body per container.

It is meant for quick sanity checks, such as "does this change hurt latency?", not as a replacement for proper load testing.

Take quiz
Where do you start a benchmark in K9s?
In the Nodes view
From the Popeye report
On a port-forward listed in :pf
Which settings can benchmarks.yaml control?
Node taints and tolerations
Concurrency, request count, HTTP method, path and headers
Pod memory limits

39. Explain the internal working of K9s?

K9s is a Go program that sits between your terminal and the Kubernetes API. It builds clients from your kubeconfig with client-go, discovers the resource types the server offers, keeps an in-memory view of the objects you are looking at, and renders that view as a table in the terminal.

flowchart LR
  A[kubeconfig] --> B["client-go clients"]
  B --> C["API server"]
  C --> D["Watches / lists + cache"]
  D --> E["Table models"]
  E --> F["Terminal UI - tview/tcell"]
  F -->|key press| G["Actions: logs, exec, patch, delete"]
  G --> C
  1. Connect - the active context supplies server address and credentials.
  2. Discover - the discovery API tells K9s which resources, aliases and short names exist, including CRDs.
  3. Observe - resource data is fetched and kept current, and views redraw on a refresh cycle (default about 2 seconds, refreshRate).
  4. Act - a key press maps to an API call (delete, patch, scale), a log or exec stream, or an external process such as your $EDITOR.

Before offering an action, K9s checks what your user is allowed to do, which is why some keys appear or disappear depending on RBAC.

Take quiz
Which library does K9s use to talk to the API server?
client-go
A shell-out to kubectl for every refresh
The Docker Engine SDK
What drives the periodic redraw of K9s tables?
A webhook from the API server to your terminal
A CronJob inside the cluster
A refresh cycle (default about 2 seconds) over observed cluster data

40. How does K9s authenticate with a cluster?

K9s has no login of its own. It loads the kubeconfig (merging every file listed in KUBECONFIG), picks the current context, and lets client-go handle whatever authentication method that context's user defines.

  • Client certificates and static bearer tokens.
  • Exec credential plugins - for example aws eks get-token, gke-gcloud-auth-plugin or kubelogin for OIDC and Azure. K9s runs the plugin and uses the short-lived token it returns.

The practical consequence: if the plugin binary is missing from PATH or the token expired (an Unauthorized error after a few hours), re-authenticate with your cloud CLI, then switch context or restart K9s. K9s can never exceed the permissions of that user.

Take quiz
How does K9s usually authenticate to an EKS cluster?
With an IAM role bundled inside K9s
Through the kubeconfig exec plugin such as aws eks get-token
By asking for a password at startup
What most likely causes 'Unauthorized' after several hours on a cloud cluster?
The short-lived token from the credential plugin expired
The skins folder became corrupted
Too many aliases are defined

41. Explain the execution flow of a K9s plugin?

A plugin is a shortcut that runs an external command for the row you have selected. It is defined in plugins.yaml in the config directory.

plugins:
  logs-stern:
    shortCut: Shift-L
    description: Stern logs
    scopes:
      - deployments
    command: stern
    background: false
    confirm: false
    args:
      - --namespace
      - $NAMESPACE
      - $NAME

  1. K9s registers the shortcut only in the views listed under scopes.
  2. On key press it fills variables such as $NAMESPACE, $NAME, $CONTEXT and $KUBECONFIG from the selected row.
  3. If confirm: true, a dialog asks first. Plugins marked dangerous: true stay disabled in read-only mode.
  4. Unless background: true, K9s suspends its screen, hands the terminal to the command, and redraws when it exits.
Take quiz
What does the scopes field of a K9s plugin define?
The clusters allowed to run it
The container image the command uses
The resource views in which the shortcut is active
What does background: true change?
The shortcut is hidden from the menu
The command runs without suspending the K9s screen
The command runs on the node instead

42. How do you build a K9s plugin that launches a debug container?

Wrap kubectl debug in a plugin scoped to pods. It attaches an ephemeral container with your tooling to a running pod, which solves the distroless "no shell" problem without touching the original image.

plugins:
  debug:
    shortCut: Shift-D
    description: Debug with netshoot
    scopes:
      - pods
    command: kubectl
    confirm: true
    dangerous: true
    background: false
    args:
      - debug
      - -it
      - --context
      - $CONTEXT
      - -n
      - $NAMESPACE
      - $NAME
      - --image=nicolaka/netshoot

Pressing Shift-D on a pod asks for confirmation, then drops you into a shell with curl, dig and tcpdump available. Ephemeral containers need a reasonably recent cluster (stable since Kubernetes 1.25) and RBAC permission on the pods/ephemeralcontainers subresource.

Take quiz
What does kubectl debug add to a running pod?
An ephemeral container
A brand new node
A sidecar injected by a mutating webhook
Which variable carries the selected pod's name in a K9s plugin?
$POD_ID
$SELECTED
$NAME

43. How are per-cluster settings stored in K9s?

Besides the global config.yaml, K9s keeps a small config file for every cluster and context under its data directory, in a path shaped like clusters/<cluster>/<context>/config.yaml (on Linux, under ~/.local/share/k9s).

k9s:
  cluster: prod-eu
  readOnly: true
  namespace:
    active: payments
    favorites: [payments, default, kube-system]
  view:
    active: po
  featureGates:
    nodeShell: false
  portForwardAddress: localhost

This file explains why K9s reopens the last namespace and view for each context. It is also the right place for per-context safety settings such as read-only on production or disabling node shell.

Take quiz
Why does K9s reopen your last namespace and view for each context?
The kubeconfig stores the last view
It saves per-context settings in a cluster/context config file
A ConfigMap in kube-system keeps it
Which per-context setting can enforce read-only for production only?
readOnly: true in that context's config
A ReadOnly label on the namespace
scopes: prod in plugins.yaml

44. How do you protect production clusters when using K9s?

Layer several guards, because only one of them is a real security boundary.

  1. RBAC first - use a read-only user or ServiceAccount for the production context. Everything else is a convenience.
  2. Read-only mode - set readOnly: true in the production context's config and use --write deliberately when a change is needed.
  3. Visual cue - give production a red skin so you never mistake the context.
  4. Disable node shell via the nodeShell feature gate for that context.
  5. Mark risky plugins with dangerous: true so they are blocked in read-only mode.
  6. Avoid Ctrl-k - it kills without any confirmation dialog.

Together these reduce slips such as deleting a pod in the wrong cluster, but a determined user with write RBAC can always use kubectl.

Take quiz
What is the real security boundary for production access?
The skin color
K9s read-only mode
Kubernetes RBAC for the user's credentials
Why is Ctrl-k riskier than Ctrl-d?
It deletes the node as well
It kills the resource with no confirmation dialog
It bypasses RBAC checks

45. How can you optimize K9s performance on large clusters?

On clusters with thousands of pods the cost comes from how much data K9s lists and how often it redraws. Reduce both.

  • Scope down - start in one namespace with k9s -n payments instead of using 0 for all namespaces.
  • Refresh less - raise refreshRate (default about 2 seconds) to, say, 5.
  • Filter early - /-l app=api narrows the view for you to read, and K9s has less to draw.
  • Skip expensive views - avoid :xray and :popeye across all namespaces.
  • Lighter pod and log settings - disablePodCounting in recent versions, and a smaller logger.tail than the default 100 lines when logs are huge.

Also make sure your RBAC lets K9s list only the namespaces you care about, so it is not forced to scan everything.

Take quiz
Which setting controls how often K9s views refresh?
refreshRate
pollInterval
tickMs
Which habit lowers load on a very large cluster?
Disabling every filter
Keeping :xray open across all namespaces
Starting in one namespace instead of all namespaces

46. How do you troubleshoot K9s failing to connect to a cluster?

K9s uses the same connection path as kubectl, so start by proving the cluster is reachable and then read K9s's own log.

  1. Run kubectl --context NAME get ns. If this fails, the problem is the kubeconfig, VPN, firewall or credentials - not K9s.
  2. Check the context with kubectl config current-context and the file in KUBECONFIG; K9s reads the same one.
  3. For cloud clusters, confirm the exec plugin is on PATH and the token is fresh (aws sso login, gcloud auth login).
  4. Run k9s info to find the log location, then k9s -l debug and tail -f that log for dial, TLS or authorization errors.

K9s retries a limited number of times (maxConnRetry) before giving up, so a flapping connection shows up as repeated dial errors in the log.

Take quiz
What is the best first check when K9s cannot connect?
Reinstall the cluster
Run kubectl get ns against the same context
Delete the skins folder
How do you capture detailed diagnostics from K9s?
Start it with -l debug and read the log file
Open :popeye
Run k9s --verbose-net

47. How do you troubleshoot missing CPU and memory values in K9s?

Empty or n/a CPU and MEM columns almost always mean the Metrics API is not serving data. Confirm with kubectl top pods; if kubectl fails, K9s cannot show numbers either.

  1. Check that metrics-server is installed: kubectl -n kube-system get deploy metrics-server.
  2. Look at the APIService: kubectl get apiservice v1beta1.metrics.k8s.io should say True under AVAILABLE.
  3. On kind or minikube, metrics-server often needs the --kubelet-insecure-tls argument because kubelet certificates are self-signed.
  4. Verify RBAC allows your user to read metrics.k8s.io resources.
  5. Wait 30-60 seconds: brand-new pods have no samples yet.
Take quiz
Which command confirms that the Metrics API works?
kubectl describe metrics
kubectl get cpu
kubectl top pods
What flag does metrics-server often need on local kind clusters?
--enable-loadbalancer
--kubelet-insecure-tls
--cluster-autoscale

48. How do you troubleshoot K9s display and rendering problems?

Garbled colors, boxes instead of icons or a misaligned layout are usually terminal issues rather than cluster issues.

  • Wrong or missing colors - export TERM=xterm-256color. Inside tmux, use a 256-color or true-color terminal type, and set COLORTERM=truecolor for skins.
  • Broken icon glyphs - install a font with the needed symbols or set noIcons: true in config.yaml.
  • Columns cut off - the window is too narrow; widen it, customize views.yaml, or toggle wide mode with Ctrl-w.
  • Odd behavior on Windows - prefer Windows Terminal over legacy consoles.

If the problem remains, start with a clean config by pointing K9S_CONFIG_DIR at an empty folder to rule out a bad skin or view file.

Take quiz
Which TERM value does K9s recommend for correct colors?
xterm-256color
dumb
vt52
Which setting hides icons that render as broken glyphs?
asciiOnly: false
ui.plain: yes
noIcons: true

49. How do you investigate a Pending pod in K9s?

A Pending pod has been accepted but not placed on a node, or its volumes or images are not ready. Start with the evidence the scheduler left behind.

  1. Select the pod in :po and press d. Read the Events at the bottom for FailedScheduling.
  2. Interpret the message. 0/3 nodes are available: 3 Insufficient cpu means the pod's requests exceed free allocatable CPU on every node. Taint and affinity messages point to tolerations or node selectors.
  3. Check :no and the %CPU/R and %MEM/R columns to see which nodes have headroom.
  4. If the message mentions an unbound claim, open :pvc and check its status and StorageClass.
  5. Check :quota if admission or quota limits are suspected.

The fix is then specific: lower requests, add nodes, adjust tolerations or repair storage.

Take quiz
Where does the scheduler's reason for a Pending pod appear?
In the container logs
In the Events section of the describe view
In the node's kubelet config file
What does '0/3 nodes are available: 3 Insufficient cpu' suggest?
Requested CPU exceeds free allocatable CPU on every node
The image pull is failing
The readiness probe is failing

50. How do you find why a Service has no endpoints in K9s?

A Service only gets endpoints for pods that match its selector and are Ready. Check both sides with K9s.

  1. Open :svc, select the Service and press d. Note the Selector and whether Endpoints shows <none>.
  2. Open :ep to see the Endpoints object itself.
  3. Go to :po in the same namespace and filter with /-l app=web using the Service's selector. No rows means a label or namespace mismatch.
  4. If pods exist, look at the READY column. Pods failing readiness probes are left out of endpoints.
  5. Press y on the Service and confirm targetPort matches the container port.

:xray svc shows the same relationship as a tree if you prefer a single picture.

Take quiz
Which view lists Endpoints objects?
:svcip
:targets
:ep
Why are pods that fail their readiness probe missing from a Service's endpoints?
Endpoints include only pods with public IPs
Only Ready pods matching the selector are added
Pods need a Service annotation to be listed
«
»

Comments & Discussions