Skip to content

Commit fc4b8ba

Browse files
Merge pull request #2 from isaaguilar/main
integration into k9s
2 parents bff1b6c + 75578d3 commit fc4b8ba

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

README.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,68 @@ kubectl ssh-proxy scp localpath [user@]host:[path]
3434
3535
# sftp secure file transfer
3636
kubectl ssh-proxy sftp [user@]host[:path]
37-
```
37+
```
38+
39+
## Use with K9s Plugin
40+
41+
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.
42+
43+
**Demo**:
44+
45+
[![asciicast](https://asciinema.org/a/515325.svg)](https://asciinema.org/a/515325)
46+
47+
48+
**Configure K9s**:
49+
50+
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

Comments
 (0)