shortcut for typing kubectl --all-namespaces everytime shortcut for typing kubectl --all-namespaces everytime kubernetes kubernetes

shortcut for typing kubectl --all-namespaces everytime


New in kubectl v1.14, you can use -A instead of --all-namespaces, eg:

kubectl get -A pod

(rejoice)


Is there any alias we can make for all-namespace

Based on this excellent SO answer you can create alias that inserts arguments between prefix and suffix like so:

alias kca='f(){ kubectl "$@" --all-namespaces -o wide;  unset -f f; }; f'

and then use it regularly like so:

kca get nodeskca get podskca get svc,sts,deploy,pvc,pv

etc..

Note: There is -o wide added for fun as well to get more detailed info about resources not normally namespaced like nodes and pv...