Nice shell in a Kubernetes pod #187
henrebotha
started this conversation in
Show and tell
Replies: 1 comment
-
|
Cool! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I sometimes have to run a shell inside a Kubernetes pod in order to debug things.
Unfortunately these in-pod shells are always extremely minimal, making even fundamental operations difficult if your fingers are used to things like
alias l='ls -lAh'.Worse, it turns out to be surprisingly difficult to e.g. pipe some shell config into this.
zsh-abbr turns out to be just the ticket. We can define a global abbreviation that will type out the verbose command needed to copy a
~/.kshellrcfile into the pod and then run Bash sourcing that file.(Linux users might need slightly different
base64arguments.)Now I can do
kubectl exec $pod -it -- @kshellto get a Bash instance with some useful predefined config.(Aside: I'm very chuffed with the idea (not mine!) to use base 64 encoding to ensure that quotes etc are not messed with! I thought that was a super neat solution. Everything else I tried had issues with quoting.)
Beta Was this translation helpful? Give feedback.
All reactions