Extend K9s with Plugins
masterK9s allows you to extend its functionality by defining custom cluster commands as plugins. Plugins are loaded from several locations, primarily $XDG_CONFIG_HOME/k9s/plugins.yaml or directories like $XDG_CONFIG_HOME/k9s/plugins and $XDG_DATA_HOME/k9s/plugins.
A plugin definition includes:
shortCut: The key combination to trigger the plugin (e.g.,[a-z],Shift-[A-Z],Ctrl-[A-Z]).description: Text displayed in the K9s menu next to the shortcut.scopes: A list of resource names/short-names (e.g.,pods,svc) where the plugin is active. Useallfor all views.command: The executable to run.args: Arguments passed to the command.background: Boolean indicating if the command runs in the background.confirm: If enabled, prompts the user to confirm before execution.override: If true, overrides the default action for that shortcut.dangerous: If true, allows the plugin to run even in read-only mode.overwriteOutput: Allows providing custom messages on plugin stdout.
plugins:
fred:
shortCut: Ctrl-L
description: Pod logs
scopes:
- pods
command: kubectl
args:
- logs
- -f
- $NAME
- -n
- $NAMESPACE