A first look at Octant – Visualizing your K8s clusters
In my lab, I run a number of different flavors of Kubernetes. Some of them I deploy via kubeadm. Others I have provisioned by VMware PKS. Some of these can access the outside world, while others are secured. Sometimes it is difficult to figure out the relationship between various K8s objects – which services, endpoints, PVs and PVCs are used by different Pods or StatefulSets. In the past I have used the K8s dashboard, but more often than not, I have to start kube proxy and then run some sort of tunnel (via PuTTY or similar) in order to be able to display the dashboard on my desktop. Its a bit of a pain to be honest, and I seem to spend a bit of time getting it to work. That was why I was very interested when I saw this tweet about Octant, a web interface that displays your workloads and objects in a dashboard, so decided to give it a go.
Developing on #Kubernetes? Get a full overview with @projectoctant, a developer-centric #opensource web interface that displays your workloads and objects in a dashboard running locally on your workstation.
Read our announcement blog by @bryanl:https://t.co/7q4n1pQQ3C pic.twitter.com/hhNneccTRZ
— Project Octant (@projectoctant) August 13, 2019
Getting started is very straight-forward. I simply pulled down the binary from the Octant releases page, followed the installation instructions from the README file, and pointed a browser from my desktop to my sandbox VM, and up it came. Now since this was a sandbox VM, I did need to pass an argument when launching Octant, which was the OCTANT_LISTENER_ADDRESS. This is the IP address of the sandbox VM. With this argument, I can point a browser from any location at the IP and port, and get the Octant dashboard. Otherwise Octant uses the locahost IP address for listening, so only accessible from a browser on the host where it was launched. Here is my Octant startup command.
cormac@pks-cli:~/octant/octant_0.6.0_Linux-64bit$ OCTANT_LISTENER_ADDR=10.27.51.18:7777 ./octant 2019-09-10T14:52:49.123+0100 INFO module/manager.go:75 registering action {"component": "module-manager", \ "actionPath": "deployment/configuration", "module-name": "overview"} 2019-09-10T14:52:49.124+0100 INFO api/content.go:52 Registering routes for overview 2019-09-10T14:52:49.125+0100 INFO api/content.go:52 Registering routes for cluster-overview 2019-09-10T14:52:49.126+0100 INFO api/content.go:52 Registering routes for configuration 2019-09-10T14:52:49.127+0100 INFO dash/dash.go:332 Dashboard is available at http://10.27.51.18:7777
On connecting to the dashboard, an overview of the default namespace is provided. In the top right hand corner are the contexts, so if you have multiple clusters defined in your ~/.kube/config file, these will be listed here.
Now things become a bit more interesting when we start drilling into the various dashboards. For the purposes of demonstration, I will deploy a simple 3 node MongoDB in its own namespace called Mongo and use that as an example. The namespace can be changed from the drop down menu across the top of the dashboard. Now I can see all object associated with that namespace; the Pods, StatefulSets, Services, PVCs, Secrets and so on.
Let’s click on the StatefulSet next. This takes us to the StatefulSet Summary view, where we can see Configuration information such as Selectors and Replicas status (this StatefulSet was deployed with 3). The screenshot shows a bunch of information about the StatefulSet. In the upper part, we have detailed information about the configuration, metadata such as annotations, the status of the replicas and the Pods.
In the lower part of the view, there is additional information on the Pod Template, such as Container image, ports, mounts and even the command. There is also information about the secret volume, used to initialize MongoDB as well as related Events. It is so cool to have all of this available at a single glance.
The YAML tab is fairly self-explanatory, as it shows the YAML for the object in question. Now, one of the really nice features of Octant is the Resource Viewer, and the relationship between application components. Here is the Resource Viewer of my Mongo StatefulSet. At a glance I can see the ServiceAccount, Service, Pods and StatefulSet. By clicking on any of the objects, the status is revealed int he upper right hand corner.
The Resource Viewer is colour coordinated for status. If I select the Pods in the Resource Viewer, I can see all 3 Pods in my StatefulSet, and since they appear in green, they are all OK. I can select the Pods, then click on any of the Pods in the status in the upper-left hand corner. This takes me directly to a detailed Pods status. Here once again, I can see the Summary, Resource Viewer and YAML of the Pod, but I can also see the Logs from the containers in the Pod. If there are more than one container in the Pod, I simply select the one that I am interested in from the drop-down. This is also really useful.
I’m really getting to like this tool. I can see it becoming very popular. I like the ease at which I can move between K8s cluster contexts with the drop down, and also the ease at which I can focus on certain namespaces. The Resource Viewer is excellent to be able to visualize the relationship between all of the Kubernetes components that go to make up a complex application.
Another nice feature is the plugins mechanism. I have some ideas about how to extend Octant myself, and am discussing it with people who are far cleverer than I am. Let’s see how that pans out. In the meantime, if you want a neat tool to visualize your Kubernetes clusters status, see the relationship between the various application objects and get quick access to events and logs, take Octant for a test drive.
[Update] Someone pointed me to this TGI Kubernetes video where Bryan Liles discusses Octant is way more detail. Check it out.