Previously, I wrote about couple of articles regarding VMware Project Octant and, it was running locally with access to the kube config file. In this post, I’m going to show you, how I configured the VMware Project Octant as a service in order to access it remotely. If you are not familiar with VMware’s Octant tool and this is the first time you heard it, it is a tool developed by VMware to have a clear insight about the Kubernetes cluster. If you need to know about more please follow my previous post.
You can find the latest releases of Octant in this GitHub releases page. My test Kubernetes cluster is sitting on the AWS Cloud platform and Amazon Linux was used as the operating system. So, I downloaded the linux tar.gz file with the latest release.
Extracted the downloaded folder and copied the executable “octant” file to the /usr/local/bin folder
- See What’s Inside In Your Kubernetes Cluster With VMware Octant
- VMware Project Octant New Release With Container Exec And Workload Viewer
- VMware Hands On Labs (HOL) And Tanzu Mission Control
- VMware Open Source Kubernetes Networking – Project Antrea
- What Is VMware Test Drive And What Are The Benefits?
Octant uses below environment variables to set the access:
- OCTANT_ACCEPTED_HOSTS – Local IP address of the machine it runs on
- KUBECONFIG – Path to the kubeconfig file
- OCTANT_LISTENER_ADDR – Listening IPs and the port (0.0.0.0 – “All IP addresses of the local machine”)
I created, the below file for my Octant Service and I used an AWS EC2 instance as my master node. Also I used EC2 metadata service to obtain the local IP of the machine as I created this service for a different purpose and along with some automation.
My user home directory and kube config file was set accordingly
tee /usr/lib/systemd/system/octant.service <<-'EOF' [Unit] Description=octant [Service] Environment="HOME=/home/ec2-user" Environment="OCTANT_ACCEPTED_HOSTS=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)" Environment="KUBECONFIG=/home/ec2-user/.kube/config" Environment="OCTANT_LISTENER_ADDR=0.0.0.0:8900" Environment="OCTANT_DISABLE_OPEN_BROWSER=true" Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" WorkingDirectory=/usr/local/bin/ ExecStart=/usr/local/bin/octant Type=simple Restart=on-failure [Install] WantedBy=multi-user.target EOF
After that, permissions were set as below
sudo chmod 755 -R /usr/lib/systemd/system/octant.service
I reloaded the daemons and started the octant service, here is my service looked like after the successful configuration.
After that, Octant page was loaded in my browser with the remote IP address as below
Alternative Method Exporting Environment Variables
I wanted to run this as a service, if you don’t need a service level configuration and just running this as a remote service, you can simply export these variables as below on the remote server to achieve this easily.
Here is the tested command I used, feel free to change local machine IP address instead of my EC2 IPv4 Metadata.
OCTANT_ACCEPTED_HOSTS=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) KUBECONFIG=~/.kube/config OCTANT_LISTENER_ADDR=0.0.0.0:8900 octant
Octant New Shell Feature
If you remember, I have published an article about Octant’s Container Exec and Workload viewer features previously and this time it was quite different.
It was not needed to load the shell manually and it was part of the tabs, which could be easily loaded the container shell as a terminal.