I Built a Kubernetes TUI Because I Was Too Lazy to Type kubectl
So there I was, SSH'd into my homelab at 2am, typing kubectl get pods -n argocd for the hundredth time that week. And I thought - there has to be a better way.
Yes, k9s exists. It's awesome. But I wanted to scratch my own itch.
The Itch
I run K3s on a few Raspberry Pis and a mini PC. Classic homelab stuff. My workflow was:
- SSH into a node
- Run kubectl commands
- Tail logs
- SSH into another node to check something with crictl
- Forget which terminal is which
- Cry
What if I could do all of this from one tool?
Enter k4s
A terminal UI for K3s/Kubernetes, built in Go with the Charm stack (Bubbletea, Lipgloss). It's not trying to replace k9s - it's just my take on the problem.
What it does:
- Switch between multiple kubeconfigs
- Browse namespaces, pods, deployments, services, events
- Live metrics (CPU/Memory) if you have metrics-server
- Stream logs with search highlighting
- SSH directly to nodes and run crictl commands
That last one is the killer feature for me. No more juggling terminals.
The Stack
Went with Go because... Kubernetes. The entire ecosystem is Go, client-go is solid, and I wanted to learn the Charm libraries.
Bubbletea's architecture (Elm-inspired) took some getting used to, but once it clicks, it's beautiful. The whole UI is just messages flowing through an update loop.
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "q":
return m, tea.Quit
}
}
return m, nil
}
Try It
git clone https://github.com/LywwKkA-aD/k4s.git
cd k4s && make install
Or check the docs: k4s.pwnx.eu
GitHub: github.com/LywwKkA-aD/k4s
What's Coming
Still early (v0.2.0), but planning:
- ConfigMaps & Secrets
- Port forwarding
- Exec into containers
- CRD support
If you're running a homelab or just want a lighter k8s TUI, give it a shot. PRs welcome, roasts also welcome.
Now if you'll excuse me, I have pods to check logs and restart.
Top comments (0)