kubectl exec -it POD_NAME -- /bin/bash
It’s awkward that the POD_NAME for this very common command is in the middle of everything else. You use this command all the time, but POD_NAME changes.
To use this, you could find it in the shell’s history then move the cursor back to POD_NAME like an animal, erase and replace. But that’s so dang clunky.
If you use Fish like a gentleman, there’s a better way.
Add these to
abbr --add --set-cursor kex "kubectl exec -it % -- /bin/bash"
Now, when you type
kex and space, the snippet is added to the terminal with
your cursor right at the spot for POD_NAME. Paste, enter, 💥.
You can read more about it here.