Skip to content

Commit e296795

Browse files
committed
Updated README
1 parent 469e7bc commit e296795

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

README.md

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
![Build Status](https://img.shields.io/github/actions/workflow/status/predatorray/kubectl-tmux-exec/ci.yml?branch=master)
66
![GitHub all releases](https://img.shields.io/github/downloads/predatorray/kubectl-tmux-exec/total)
77

8-
A kubectl plugin that controls multiple pods simultaneously using [Tmux](https://github.com/tmux/tmux).
8+
A **kubectl** plugin for executing commands interactively across multiple pods or containers using [**tmux**](https://github.com/tmux/tmux),
9+
like `csshX` or `pssh` but for **Kubernetes**.
910

1011
![screenshot](../assets/screenshot.png?raw=true)
1112

12-
It is to `kubectl exec` as `csshX` or `pssh` is to `ssh`.
13-
14-
Instead of `exec bash` into multiple pod's containers one-at-a-time, like `kubectl exec pod{N} /bin/bash`.
15-
16-
You can now use
13+
To execute command across all the Nginx containers using `bash` for example, run:
1714

1815
```sh
1916
kubectl tmux-exec -l app=nginx /bin/bash
@@ -29,7 +26,7 @@ kubectl tmux-exec -l app=nginx /bin/bash
2926

3027
2. `brew install predatorray/brew/kubectl-tmux-exec`
3128

32-
The script should be installed under `/usr/local/bin/kubectl-tmux_exec` by default. Please ensure the `bin` directory is in your `$PATH` environment variable.
29+
Finally, ensure `/usr/local/bin/kubectl-tmux_exec` is in your `$PATH`.
3330

3431
### Krew
3532

@@ -49,15 +46,17 @@ The script should be installed under `/usr/local/bin/kubectl-tmux_exec` by defau
4946

5047
2. Unpack the kubectl-tmux-exec-*.tar.gz file and copy all the files to a directory, `/usr/local/kubectl-tmux-exec` for instance.
5148

52-
3. Add the `bin/` directory to PATH. For example, add this line to your rc file: `export PATH="$PATH:/usr/local/kubectl-tmux-exec/bin"`.
49+
3. Add the `bin/` directory to your `$PATH`. For example, add this line to your rc file: `export PATH="$PATH:/usr/local/kubectl-tmux-exec/bin"`.
5350

5451
4. Install the dependencies. ([Wiki: How-to-Install-Dependencies](https://github.com/predatorray/kubectl-tmux-exec/wiki/How-to-Install-Dependencies))
5552

5653
## Usage
5754

58-
To execute this script as a [plugin]((https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/)), a `kubectl` version prior to `1.12.0` is required and the latest version is preferred. Alternatively, you can also execute the script directly like `kubectl-tmux_exec [...ARGS]` if it is not supported.
55+
Make sure you have `kubectl` 1.12 ([plugin support]), ideally latest.
5956

60-
By executing the command below, you can check if the script has been successfully added.
57+
Otherwise, execute the script directly: `kubectl-tmux_exec [...ARGS]`.
58+
59+
Check if the script has been successfully added by:
6160

6261
```sh
6362
kubectl plugin list
@@ -84,22 +83,22 @@ kubectl-tmux_exec --help
8483

8584
### Options
8685

87-
Flag | Usage
88-
--- | ---
89-
`-V`<br>`--version` | Print the version information
90-
`-l`<br>`--selector` | Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)<br>You must either use `--selector` or `--file` option.
91-
`-f`<br>`--file` | Read pod names line-by-line from a file.<br>You must either use `--selector` or `--file` option.
92-
`-c`<br>`--container` | Container name. If omitted, the first container in the pod will be chosen
93-
`-i`<br>`--stdin` | Pass stdin to the container (**deprecated**, since it's enabled by default)
94-
`-t`<br>`--tty` | Stdin is a TTY (**deprecated**, since it's enabled by default)
95-
`-d`<br>`--detach` | Make the Tmux session detached
96-
`-n`<br>`--namespace=` | The namespace scope for this CLI request (can be applied multiple times)
97-
`--context` | The name of the kubeconfig context to use (can be applied multiple times)
98-
`-A`<br>`--all-namespaces` | If present, list and execute the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
99-
`-C`<br>`--enable-control-mode` | Start tmux in control mode and echo is disabled. (See: [iTerm2 Integration](#iterm2-integration))
100-
`--remain-on-exit` | Remain Tmux window on exit
101-
`--select-layout` | One of the five Tmux preset layouts: even-horizontal, even-vertical, main-horizontal, main-vertical, or tiled.
102-
`--session-mode` | Where tmux is opened: auto, new-session, current-session
86+
| Flag | Usage |
87+
|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
88+
| `-V`<br>`--version` | Print the version information |
89+
| `-l`<br>`--selector` | Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)<br>You must either use `--selector` or `--file` option. |
90+
| `-f`<br>`--file` | Read pod names line-by-line from a file.<br>You must either use `--selector` or `--file` option. |
91+
| `-c`<br>`--container` | Container name. If omitted, the first container in the pod will be chosen |
92+
| `-i`<br>`--stdin` | Pass stdin to the container (**deprecated**, since it's enabled by default) |
93+
| `-t`<br>`--tty` | Stdin is a TTY (**deprecated**, since it's enabled by default) |
94+
| `-d`<br>`--detach` | Make the Tmux session detached |
95+
| `-n`<br>`--namespace=` | The namespace scope for this CLI request (can be applied multiple times) |
96+
| `--context` | The name of the kubeconfig context to use (can be applied multiple times) |
97+
| `-A`<br>`--all-namespaces` | If present, list and execute the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. |
98+
| `-C`<br>`--enable-control-mode` | Start tmux in control mode and echo is disabled. (See: [iTerm2 Integration](#iterm2-integration)) |
99+
| `--remain-on-exit` | Remain Tmux window on exit |
100+
| `--select-layout` | One of the five Tmux preset layouts: even-horizontal, even-vertical, main-horizontal, main-vertical, or tiled. |
101+
| `--session-mode` | Where tmux is opened: auto, new-session, current-session |
103102

104103
The usage of these options is also available by `--help`.
105104

@@ -119,22 +118,21 @@ If you are not familar with Tmux, you can have a look at tmux's man page or onli
119118

120119
### iTerm2 Integration
121120

122-
Since [iTerm2](https://iterm2.com/index.html) has been [integrated with tmux](https://iterm2.com/documentation-tmux-integration.html), we can have a better native user interface, instead of remembering all the shortcuts.
121+
With `-C` or `--enable-control-mode`, it runs in control mode and delegates pane input to [iTerm2]'s "Broadcast Input" feature,
122+
no need for tmux key bindings.
123+
124+
Use <kbd>⌘</kbd> + <kbd>⌥</kbd> + <kbd>i</kbd> to toggle broadcasting in iTerm2. (`synchronize-panes` will be disabled automatically in this mode.)
123125

124-
All we have to do is to turn on the Control Mode, by adding the option `-C` / `--enable-control-mode` when executing the script. After that, the iTerm2 application will take full control of the tmux session.
126+
(see: [tmux Integration](https://iterm2.com/documentation-tmux-integration.html) for more information)
125127

126-
For example, executing the commands below in an iTerm2 session
128+
#### Example
127129

128130
```sh
129131
kubectl tmux-exec -C -l app=nginx /bin/bash
130132
```
131133

132-
will result in something like the screenshot below.
133-
134134
![screenshot](../assets/screenshot-iterm2-integration.png?raw=true)
135135

136-
Note that, the `synchronize-panes` will be disabled automatically in this mode, since the iTerm2 provides a much easier way to achieve this. To turn this on, press <kbd>⌘</kbd> + <kbd>⌥</kbd> + <kbd>i</kbd>, or click *"Shell"* - *"Broadcast Input"* - *"Broadcast Input to All Panes in Current Tab"* in the menu bar.
137-
138136
### Shell Auto-completion
139137

140138
Please check [this wiki](https://github.com/predatorray/kubectl-tmux-exec/wiki/Shell-Auto-completion) for more information.
@@ -155,20 +153,21 @@ All Tmux command starts with a `PREFIX`. By default the `PREFIX` is <kbd>Ctrl</k
155153

156154
`C-b &y`, close the window including all panes.
157155

158-
## Discussion & Support
159-
160-
Please feel free to [open an issue](https://github.com/predatorray/kubectl-tmux-exec/issues/new) if you find any bug or have any suggestion.
156+
## Community & Support
161157

162-
Alternatively, join the [Google Group](https://groups.google.com/g/kubectl-tmux-exec) and start a conversation.
158+
- File issues or feature requests via [GitHub Issues]((https://github.com/predatorray/kubectl-tmux-exec/issues/new))
159+
- Join the [Google Group](https://groups.google.com/g/kubectl-tmux-exec) for discussions
163160

164161
## Other plugins
165162

166163
[kubectl-alias](https://github.com/predatorray/kubectl-alias): the missing alias command for kubectl.
167164

168165
## Buy Me a Coffee
169166

170-
If you find this tool useful, [buy me a coffee]. Thanks!
167+
If it saves you time, feel free to [buy me a coffee] 🙌
171168

172169
[![](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)][buy me a coffee]
173170

174171
[buy me a coffee]: https://buymeacoffee.com/predatorray
172+
[iTerm2]: https://iterm2.com/index.html
173+
[plugin support]: https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/

0 commit comments

Comments
 (0)