Your most important shell alias for Kubernetes

I have been on a mission as of late to use more shell aliases, and Matt Tucker at the last Kubernetes meetup, in Boulder, reminded me of huge time savers for kubectl / Kubernetes users.

Here is the fantastic time saver that needs to be in your shell profile:

alias k=kubectl

For those who are not familiar, kubectl is the command line interface tool for running commands against Kubernetes clusters. Most K8s users, use kubectl a lot.

As mentioned in the kubectl cheat sheet, kubectl supports autocomplete in both the bash and zsh shells.

# setup autocomplete in bash, bash-completion package should be installed first.
source <(kubectl completion bash)
# setup autocomplete in zsh
source <(kubectl completion zsh)
# for help on setting up autocomplete
kubectl completion -h

For those who want to have more aliases here is 600 for your viewing pleasure: https://github.com/ahmetb/kubectl-aliases.

A humerous story, one of the bugs I found in the PetSet documentation, was that the author documented using k instead of the kubectl command.

For Help with KubernetesAdoption, kops, or all things Kubernetes. Have me contact you today!