Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a plugin to k9s?

Tags:

kubernetes

I want to add the dive plugin to k9s.... so I can examine docker images in my cluster.

I know dive works for me locally - as in dive <image:tag> is fine... however I don't have all images in the service on my workstation

https://github.com/derailed/k9s/tree/master/plugins implies this is easy to do.

I'm running ubuntu, and I've a file called dive.yml which is identical to https://github.com/derailed/k9s/blob/master/plugins/dive.yml - except I changed the shortcut to be b rather than d:

plugin:
  dive:
    shortCut: b
    confirm: false
    description: "Dive image"
    scopes:
      - containers
    command: dive
    background: false
    args:
      - $COL-IMAGE

I've tried the file in /etc/xdg/k9s/dive.yml and /home/<me>/.config/k9s/dive.yml - and neither appear to work:

I start k9s; select a pod & hit <enter> to list the containers.... highlight the image I want to examine & tap b - nothing.

Am I misunderstanding the scope of dive?

Do I have it incorrectly configured?

How do I get it to work?

like image 801
CodeGorilla Avatar asked Sep 17 '25 12:09

CodeGorilla


2 Answers

Check the output of k9s info command. It will print the expected plugins file location. You should append the plugin definitions to this file.

For those who upgrade to >= 0.30.0 from earlier versions, older config files have .yml extension and newer versions expect .yaml extension. Move your plugins.yml file to plugins.yaml You may also want to check the auto generated config.yaml contains your config.yml changes.

Another thing I found out is that the root of the plugins.yaml file was plugin for me and it should be changed with plugins.

 ____  __.________
|    |/ _/   __   \______
|      < \____    /  ___/
|    |  \   /    /\___ \
|____|__ \ /____//____  >
        \/            \/

Version:           v0.31.7
Config:            /home/yusuf/.config/k9s/config.yaml
Custom Views:      /home/yusuf/.config/k9s/views.yaml
Plugins:           /home/yusuf/.config/k9s/plugins.yaml
Hotkeys:           /home/yusuf/.config/k9s/hotkeys.yaml
Aliases:           /home/yusuf/.config/k9s/aliases.yaml
Skins:             /home/yusuf/.config/k9s/skins
Context Configs:   /home/yusuf/.local/share/k9s/clusters
Logs:              /home/yusuf/.local/state/k9s/k9s.log
Benchmarks:        /home/yusuf/.local/state/k9s/benchmarks
ScreenDumps:       /home/yusuf/.local/state/k9s/screen-dumps
like image 112
Yusuf Tarık Günaydın Avatar answered Sep 19 '25 08:09

Yusuf Tarık Günaydın


Sidenote:

Take care which scope your plugin has. I tried to press the shortcut and nothing worked, because i was in the wrong scope (deployment instead of container)


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!