You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [K9s](https://github.com/derailed/k9s) project has a plugin feature that allows users to configure key-mappings to execute commands on your system.
The following implements a plugin that uses `kubectl-ssh-proxy` to easily SSH into any node directly from K9s. First, create or modify the file `$XDG_CONFIG_HOME/k9s/plugin.yml`. If `XDG_CONFIG_HOME` is not used in your terminal, simply define it to any directory.
51
+
52
+
Example:
53
+
54
+
```bash
55
+
export XDG_CONFIG_HOME=$HOME/.config
56
+
```
57
+
> Older versions of k9s might have config in `~/.k9s/` instead.
58
+
59
+
Next create the `$XDG_CONFIG_HOME/k9s/plugin.yml` file:
60
+
61
+
```yaml
62
+
# $XDG_CONFIG_HOME/k9s/plugin.yml
63
+
plugin:
64
+
# Defines a plugin to provide a `ctrl-n` shortcut to tail the logs while in node view.
65
+
ksshNode:
66
+
# Define a mnemonic to invoke the plugin
67
+
shortCut: Ctrl-N
68
+
# What will be shown on the K9s menu
69
+
description: Node SSH
70
+
# Collections of views that support this shortcut. (You can use `all`)
71
+
scopes:
72
+
- no
73
+
# The command to run upon invocation. Can use Krew plugins here too!
74
+
command: kubectl-ssh-proxy
75
+
# Whether or not to run the command in background mode
76
+
background: false
77
+
# Defines the command arguments
78
+
args:
79
+
- ssh
80
+
- ec2-user@$NAME
81
+
82
+
# Defines a plugin to provide a `ctrl-n` shortcut to tail the logs while in pod view.
83
+
ksshPod:
84
+
# Define a mnemonic to invoke the plugin
85
+
shortCut: Ctrl-N
86
+
# What will be shown on the K9s menu
87
+
description: Node SSH
88
+
# Collections of views that support this shortcut. (You can use `all`)
89
+
scopes:
90
+
- po
91
+
# The command to run upon invocation. Can use Krew plugins here too!
92
+
command: kubectl-ssh-proxy
93
+
# Whether or not to run the command in background mode
94
+
background: false
95
+
# Defines the command arguments
96
+
args:
97
+
- ssh
98
+
- ec2-user@$COL-NODE
99
+
```
100
+
101
+
After this you should be ready to to start up K9s. Then simply select a node, press `ctrl-n`, and viola! `kubectl-ssh-proxy` is used to SSH into the selected node.
0 commit comments