I made my own zsh/bash function to more easily handle contexts and namespaces. I also run this every time with a kubectl alias to know which environment a certain command is being run against:
I think one big topic would be about using --output='jsonpath=...', vs --output='json' | jq ....
Personally, I find jq much more user-friendly, but jsonpath is so much more portable - just copy the script and no need to make sure you have jq installed… What do people think?
I use a couple similar to kcns and kex fairly regularly.
I also have alias kc='kubectl --namespace ${KUBE_NAMESPACE:-default} ' so I can export a namespace easily in a shell and not always have to type it. For me, kcns sets that variable
This might be obvious for some, but I was very excited when I learned about kubectl explain. It explains resources and/or the fields of their configuration (e.g. kubectl explain resource.field.field).
I forgot to mention! Sometime last year I wrote kubeplay. It is intended for interactive scripting, like a REPL basically.
Personally, I find kubectl to tedious, and gluing it with shell scripts can be even more tedious.
Currently, kubeplay uses Ruby syntax (via mruby embedded in a Go program), but I am keen to explore other options. I am also not a fan of pseaudo-graphical interactive console apps, so this more of a pure REPL based on a proper language
Take a look and let me know if you would be keen to use it, I would love to put more time into it!
Ok this might sounds very stupid, but here some alias I use for kubectl:
alias k='kubectl'
alias watch='watch '
alias pods='k get pods'
alias spods='k get pods -n kube-system'
alias deployments='k get deployments'
alias sdeployments='k get deployments -n kube-system'
alias ds='k get ds'
alias sds='k get ds -n kube-system'
alias logs='k logs'
alias slogs='k logs -n kube-system'
In general I think the best aliases are the one you build for yourself and that make your life easier every day… and I really can’t live without my “spods”.