k9s + microk8s
k9s is an awesome way to manage kubernetes/microk8s over ssh since it offers a text-based UI.
To install:
$ sudo snap install k9s
To make k9s see local microk8s instance:
$ microk8s.kubectl config view --raw > $HOME/.kube/config
Logs
If k9s isn’t working correctly, the details may be in the log.
Run k9s info to reveal the location of the log file (in my case /tmp/k9s-root.log),
then run
$ tail -f /tmp/k9s-root.log
to reveal the log.
kubectl
Trying to access shell fails with Shell exec failed. Looking into k9s logs it reveals
that kubectl command is not in your path error="exec: \"kubectl\": executable file not found in $PATH".
Unfortunately, creating an alias via alias kubectl="microk8s kubectl" is not enough.
The easiest way is to install kubectl client:
$ sudo snap install kubectl --classic
$ kubectl get pod --all-namespaces
Tips
- To quit, type
:q - If viewing logs will only yield
waiting for logs: press0to see all logs from the top - Try the Pulse mode via
:pulse, it’s really cool.
Written on January 10, 2025