Command-line tools for Kubernetes: kubectl, stern, kubectx, kubens

Command-line tools for Kubernetes: kubectl, stern, kubectx, kubens

If you’ve ever worked with your hands, you know that you can’t do the job right without the right tools. That adage carries over quite well to software development as well. The right tools can make the difference between success or failure, regardless of the underlying technology.

In the Kubernetes ecosystem, more and more tools are being introduced as folks find ways to solve a common problem. This article looks are four of those tools. The standard command-line tool for Kubernetes, you can perform all the operations of Kubernetes that are required.

This is the starting point for any Kubernetes administration. kubectl is the command-line tool for Kubernetes and is under the stewardship of the Cloud Native Computing Foundation, which brings us Kubernetes. Kubectx is helpful for multi-cluster installations, where you need to switch context between one cluster and another.

Rather than type a series of lengthy kubectl command, kubectx works it magic in one short command. It also allows you to alias a lengthy cluster name into an alias. For example (taken directly from the kubectx website), kubectx eu=gke_ahmetb-samples-playground_europe-west1-b_dublin allows you to switch to that cluster by running kubectx eu.

Another slick trick is that kubectx remembers your previous context—much like the “Previous” button on a television remote—and allows you to switch back by running kubectx -.