While Kubernetes is a very powerful and comprehensive application, it can also be very complicated and confusing to new users. Thankfully, the community is great at pulling together to try to tame the Kubernetes beasts, and as more users join the platform, more handy tools to help you manage your cluster are developed. Kubernetes Resources range from everyday helper tools to development tools to troubleshooting tools, and in this article we’ll discuss fifteen of the best ones.
Everyday Helper Tools
These are your “quality-of-life” tools that will make your everyday use of Kubernetes a little less painful. They offer shortcuts to common commands, simplify complex processes, and let you focus more on the things that matter.
Kubectl Cheat Sheets
When learning a new tool, it takes a while before you can memorize all the basic commands associated with it. A “cheat sheet” of these commands can be helpful to have on hand. Check out the official kubectl cheat sheet, which explains various typical commands in great detail. It provides pretty much everything you’ll need on a daily basis, from finding resources to interacting with them.
This is a good place to start as a beginner, but be wary about becoming too reliant on it. There’s a system to how the
kubectl command works, and you should only use the cheat sheet to help understand that system. If you can wean yourself off of it, you’ll be able to work faster and with more confidence.
Once you’re relatively familiar with what
kubectl commands are available to you, it’s time to upgrade your terminal experience with aliases. Aliases are a way to reference a command, or multiple commands, by using one short keyword. Kubectl Aliases is a great tool that’s exactly what it says on the box: a bunch of aliases for
A great alias I use often is
kgpo, which executes
kubectl get pods. Getting pods is fairly easy, but say you want to watch the pods as their status changes, and you want the output in YAML. Because aliases are autogenerated, you’ll be able to find one for every specific use case you need. So, instead of
kubectl get pods --watch -o=yaml, just run the alias
kgpowoyaml. Trust me, you’ll get used to it.
If you’re using
zshas your shell, I can highly recommend installing alias-tips alongside this. That way, you’ll see what the alias is for a
kubectlcommand, in case you ever need to type the full command.
Kubectx and Kubens
This one is simple but a lifesaver when you’re working with multiple Kubernetes clusters or just multiple namespaces within the same cluster. Using pure
kubectl, you would write
kubectl config set-context --current --namespace=ingress to switch to the
ingress namespace. With kubens/kubectx (they’re bundled in the same installation), you can just write
To power up this tool even more, install fzf on your system. Then you can run
kubens, and it will give you an interactive list of your namespaces to choose from.
Cheat sheets and aliases are a great way to improve the
kubectl command, but if you’re tired of typing commands in general, then K9s may be for you. It launches a GUI in your terminal, which gives you a much greater overview of your cluster, while also providing shortcuts for things like viewing logs, describing resources, and viewing their YAML definitions.
Those are just some of the basic things you can do with K9s. Download the tool and try it out. The downside to K9s is that it’s not entirely beginner friendly. There aren’t any explanations for what the different commands do, and it’s expected that you know your way around
If you’re a Vim user, you’ll be happy to know that it supports j+k for navigation.
Development tools are used to help with specific development tasks in Kubernetes. They could allow things like spinning up a local cluster for testing, double-checking syntax, or simplification of a specific complex task.
Minikube allows you to spin up a local cluster, which you can then connect to. It’s a great way to test things out when you don’t have access to a development cluster, and is useful to both new and experienced Kubernetes users.
Using Minikube, you can test out things like whether your deployment scripts work or if your application works the way you intend after it’s deployed to Kubernetes. There are many advantages to having a local cluster, where you don’t have to worry about messing things up.
While Minikube works on all platforms, I would only really recommend it for Linux. If you’re using Windows or Mac, it may make more sense to use Docker Desktop, which you probably already have installed if you’re using Docker. Once Docker Desktop is installed, it’s a matter of going into the settings of the application and enabling Kubernetes support.
As far as functionality, it’s pretty much the same as Minikube.
It’s already a daunting task to write the YAML files needed for a Kubernetes deployment, but if you have a lot of
docker-compose.yml files that you need to convert into Kubernetes deployments, then it can become a real headache. Luckily Kompose exists to help with exactly this.
With a simple
kompose convert -f docker-compose.yml command, it will not only create the deployment file but everything else related to it. For example, if you have some folders mounted into your Docker container, it will also create the
PersistentVolumeClaims to be populated.
Do be aware if you have any secrets mounted as environment variables. It will pull the variables from your system and write them as plain-text in the generated files.
YAML is a markup language defined by whitespace. This can make it notoriously difficult to work with, and errors can happen because of a missing tab or two spaces instead of a tab. Using a tool like Yamllint can make sure that at least the syntax of your Kubernetes files are valid. It’s a simple tool, but in the long run it can save a lot of time debugging.
There are multiple ways to use Yamllint. One is to just use it locally when writing the files. Another is to include it in your CI/CD pipeline, as an extra validation step to make sure any files are YAML valid.
One of the most annoying things about coding is having to manually recompile after every code change. Most languages these days provide tools for watching your code and automatically recompiling/running it, but what about when you want that code to live in Kubernetes while you’re developing?
Enter Skaffold. You create the Dockerfile, run
skaffold init to create the needed Kubernetes files, and finally
skaffold dev to compile, deploy, and watch. This way, you can make sure your application works as intended within Kubernetes, without any manual steps.
There are many ways to deploy to Kubernetes,
kubectl apply -f being the most traditional. This is a great way to deploy a static setup. However, in most setups there are slight deviations based on your environment: dev, prod, staging, and so on. Kustomize lets you define your Kubernetes files and then create so-called “patch” files.
The tool is used to define a
yaml file with the base settings for your deployment. Then you create separate
yaml files where you define the settings that change based on your environment, and only the settings that need to change. A significant upside to Kustomize is that it’s built straight into
Sometimes a tool like Kustomize isn’t enough. Sometimes patching isn’t enough. Sometimes you just need more advanced features like interpolation, version control, and a values file that can be overwritten via command-line or a separate file. Helm is Kustomize on steroids. So why use Kustomize if Helm is available? Well, with Helm’s advanced features also comes advanced complexity.
But don’t let that scare you away from using it. It’s a great tool and allows you to do a whole lot. Personally it’s what I use when I have to do Kubernetes deployments—just be aware that it’s not beginner friendly.
As the name suggests, troubleshooting tools help check your code for errors. They do things like give insight into your cluster, keep track of your services, and provide error logs.
Sometimes it’s nice to have a general overview of what’s happening inside your cluster. Every Kubernetes cluster has a web UI built into it—it just has to be activated. Once activated, you get insights like how many pods you’re running, resource usage, and logs. It’s a great way to get a quick overview into your cluste, and can help with troubleshooting.
Viewing logs is an essential part of any troubleshooting scenario, but Kubernetes by default only allows you to view logs from a single pod at a time. Kubetail allows you to collect logs from multiple pods into a single stream, eliminating the need to open multiple terminals. This also makes it easier to correlate logs from different services, rather than trying to compare timestamps.
If you’re running Kubernetes, chances are you’re running many services. This can be tough to keep track of, and a map would help. This is exactly the use case that Weave Scope aims to solve. It analyzes your cluster and creates a cohesive map of not just what services you have, but also how they all fit together.
Not only does this mean you have a deeper knowledge of what services you have, but it can be a huge aid in troubleshooting. Let’s say you have two services that are supposed to communicate but aren’t. Weave Scope can confirm if the services are in fact running, and help you troubleshoot why they aren’t talking.
Monitoring is essential to maintain uptime. Getting notified when something goes wrong results in quicker response times. Kubewatch monitors your Kubernetes cluster and, based on your configuration, can send notifications to Slack, HipChat, Mattermost, and more. If you only want to be notified regarding changes, Kubewatch is a great alternative to other monitors like Datadog or New Relic.
While hackers are constantly evolving and figuring out new exploits, there are some standard security risks that are common across Kubernetes. There are tools available to scan for these, and Kubesec is one of the most popular. Install the tool locally or use their web service to scan your
yaml files for any common security holes.
Now you’ve been presented with the fifteen most handy tools for Kubernetes. Chances are you won’t be using every single one in your daily life, but try them all out and see how they work for you. Who knows, maybe you’ll look back and wonder how you ever lived without them. I certainly do!
If you’re hungry for more, the Kubernetes community is vast and wonderful, so you’re bound to find even more handy tools along your journey that will meet any specific use case that you have. Also check out our recent blog on Top 5 Kubernetes load testing tools and how they compare.
Speedscale helps developers release with confidence by automatically generating integration tests and environments. This is done by collecting API calls to understand the environment an application encounters in production and replaying the calls in non-prod. If you would like more information, drop us a note at email@example.com .