VMware : Tips of the week #4

We want to share with you some concepts, helpful commands, and gotchas that we have come across during the first few days within the Kubernetes world.  

Kubernetes uses a command-line tool called kubectl for running commands against clusters,  you may find yourself frustrated by the time spent typing repetitive commands.

This article will highlight tips used to simplify the usage of kubectl and save you time.

Shell aliases can be used to shorten all shell commands and not just those related to kubectl. Begin by creating a file in your $HOME directory specific for kubectl aliases, and add all helpful aliases for kubectl such as :

Here top 10 shell aliases for 𝐤𝐮𝐛𝐞𝐜𝐭𝐥:

  • alias k=’kubectl’
  • alias kgns=’kubectl get namespaces’
  • alias kgc=’kubectl config get-contexts’
  • alias kuc=’kubectl config use-context’
  • alias kg=’kubectl get’
  • alias kgn=’kubectl get nodes’
  • alias kgp=’kubectl get pod’
  • alias kgpall=”kubectl get pods –all-namespaces”
  • alias krm=”kubectl delete’
  • alias kgsvc=’kubectl get service’

And then edit your .bashrc file with the following:

If you need to list all your aliases just run: 

kubectl shell autocompletion is another way to save time. To configure shell autocompletion on centos just run:

If you get a message with the error below: 

You can fix this with these commands:

If you are not a CLI champion, one of the tool you can use is Octant from VMware.

Octant is a web interface for Kubernetes that gives you the visibility of your Kubernetes cluster and applications running on it.

Enjoy!

1 thought on “VMware : Tips of the week #4”

Leave a Reply

Your email address will not be published. Required fields are marked *