Crash Course In Java Brain Surgery

insinuation and speculations: My thoughts about Java, HTML5, software development and IT in general

5 Kubernetes Tools You Probably Don’t Use (But You Should)

Written by  Viktor Gamov -
k9s ksql
TL;DR
In this post, I’m going to talk about few tools that I found very useful during my Kubernetes development and presentations.
Table 1. Revisions history
Version Date Comments

v1.1

03/26/2019

Finished draft

v1.0

03/11/2019

Initial draft

Earlier this year, I recorded a three-episode series, «Streaming on Kubernetes: It doesn’t have to be the hard way.» There I showed some demos of the Confluent Operator on Kubernetes. Many people reached out after and asked - «What kind of terminal do you use,» «What kind of plugins do you use» and so far and so on. And today, I’m going to be talking about five Kubernetes tools that I use in my demos (of during preparations to it) that you’re probably don’t use but defiantly should.

So, let’s get to it - it’s going to be fun!

Put your prompt to work

OK, I do demos. Many demos. OK, not like a lot of demos but still, a large number of demos. And things that I’m usually demoing very technical. So technical some things I demo don’t even have GUI. The only thing that I have to interact with those things is the command line interface, aka terminal.

As the theatre starts with a coat, a proper terminal starts with a prompt. Because during those technical demos, there are many things going in on the screen.

So, having an excellent terminal prompt that will allow the audience and yours truly always to know where we are? That’s why I appreciate kube-ps1 that displays information about the current Kubernetes cluster context as part of a terminal prompt. Also, it adds two a helper commands kubeon and kubeoff that allow for turning this prompt on and off on demand.

It does work great in bash and zsh.
kubeon
Figure 1. Current Kubernetes cluster in your command line

Cluster context and namespaces switching on your fingertips

Next, I do create and use many Kubernetes clusters on a daily basis. Some days I may create a few Kubernetes clusters Saying this, I need to switch between those quite often. It may need to type a few commands if you don’t know what full name of a cluster (and I can be a quire long) See yourself!

kubectx
kubectl config get-contexts (1)
kubectl config current-context (2)
kubectl config use-context <NAME OF CONTEXT> (3)
1 Get list of all Kubernetes clusters configured in your system
2 Get a current cluster context
3 Set desired cluster context

Not so useful, right? Yet, there is a better way!

Enter kubectx.

kubectx demo

kubectx allows switching between Kubernetes clusters few quickly. It also integrates with command pager utility, and allows you to have some text menu where you can choose a specific cluster!

As a bonus, there is another tool that comes from the same author called kubens that I allow to switch namespaces withing the same cluster context. Same with namespace switching - not rocket science, but you need to remember or google those commands all the time.

Monitoring cluster health and Kubernetes Resources Right From Your Terminal

OK, good, now you learned to switch between Kubernetes clusters and namespaces in those clusters. The next tool can be a bit useful because it provides a GUI (terminal UI) tool that allows you to interact with your Kubernetes cluster.

You can see:

  • Standard Kubernetes resources and well as custom resources and KafkaCluster or PhysicalStatefulCluster

  • You can drill down to pods and see logs from the individual containers.

  • You watch health and vitals of your Kubernetes cluster and your applications.

k9s ksql

Also, this tool has many customization hooks!

Web UI to remote Kubernetes without installation!

Have you ever used Kubernetes Dashboard? Yes, you have because it’s a standard monitoring dashboard for Kubernetes. But there is one slight problem - it requires installation on your cluster. If you don’t have enough rights, or your operations folks don’t want to have extra crap installed in your Kubernetes cluster, this may be a challenge to get you GUI.

Enter Octant. It’s a web-based Kubernetes resource visualizer.

And it doesn’t require installation on your Kubernetes cluster. Octant runs locally on your machine and talks to Kubernetes via standard API calls.

octant
Figure 2. Killer feature is a resource dependency graph
octant crds
Figure 3. Apart from understanding standard Kubernetes resource, octant shows some custom resources

Another very cool feature of octant is «Port Forwarding». It works like this:

  • Navigate to the resource, e.g. controlcenter StatefulSet

  • Scroll to the container that want to forward ports from.

  • And you can click «Start Port Forward».

  • Octant UI will display localhost and port to the pod.

octant c3
Figure 4. Octant port-forwarding Control Center on localhost
octant port
Figure 5. You can get a list of all port forwards

Checking what the Helm is happening

Our last small nifty tool for today is Helm Cabin - your dashboard for helm releases. image::helm-cabin.jpg[]

You will be able to see all your helm releases deployed to given Kubernetes cluster. Once you click on one of the release names, we drill down to some helm release info - NOTES from chart, templates and values, and «effective» chart.

cabin chart details
Figure 6. Chart details

In my opinion, this is pretty useful tool for housekeeping and audit purposes.

Conclusion

If you have found this video useful or entertaining, hit that like button and consider subscribing to this channel. Stay tuned for the next one. And as always, have a nice day!

tags: