We work a lot with Kubernetes and when you're working with Secrets it can be a total pain to edit them. A standard workflow can be something like.
...
For further actions, you may consider blocking this person and/or reporting abuse
Great tip. Didn't know about this 👍🏼
Thanks! Helpful in the CKA(D) too
Yeah totally. I am just on my journey preparing for CKAD
Good luck we are studying for it as a team right now
I am also preparing for CKAD. Please add me in :)
Tip: I have a base64 Vim plugin installed that makes this even easier! Just
kubectl edit...
and then encode/decode from within Vim. No other commands needed.The plugin does this under the hood if you checkout the auto load file.
Personally like to avoid plugins if it’s easy enough to learn so I can edit in any environment or on a server without feeling hamstrung
Nice tip.
For a bit more convenience (so you don't have to edit or move the text to a new line):
:help <cword>
and:help <cWORD>
for more informationFor even more convenience, this can be converted into a reusable function:
Now, you can call it with
:call B64ify()
Lastly, you can map this function to a command and/or keybinding for maximum convenience:
This can also be reversed very easily by copying the function and replacing
base64
withbase64 -d
.Here is a final demo:
The final config:
Nice tip - I love the
<cWORD>
approach to a lot of things. One limitation is<cWORD>
uses vi's word selection. If my secret is a multiline certificate, the contents of a yaml file, or has special characters this won't work.That's true.
If you want to visually select the text to pass to an external program, by default vim passes whole lines (e.g.
:'<,'> ! base64
) , but vis.vim plugin might help (e.g.:'<,'>B ! base64
).Can you please tell me about this interactive presentation display you used for showing commands?
Hey, I have been using Terminalizer github.com/faressoft/terminalizer. I also have used asciinema.org/ which does web players rather than gifs.
Thank you!!!
Thats very useful! Thanks for sharing ♥️
Of course thanks for reading