Skip to content

Latest commit

 

History

73 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KubeConnect

Author: Theekshana Nuwan (nuwandev)

A small Windows terminal tool that speeds up working with VMware Tanzu Kubernetes clusters: login, browse resources, and tail logs, all from one keyboard-driven menu instead of memorizing/copy-pasting kubectl-vsphere commands.

Built to save time on a repetitive daily workflow. It's just a thin, config-driven wrapper around three existing CLI tools (kubectl-vsphere, k9s, stern) — no magic, no reimplemented authentication.

kubectl-vsphere.exe login [long command] → type password → kubectl context ready → k9s --context <context>

becomes

kc  →  pick an environment  →  Enter

Features

  • Arrow-key / type-ahead environment picker — built entirely from your own config file, no hardcoded cluster list
  • Automatic login via kubectl-vsphere, password never touching argv/disk/logs
  • Skips the password prompt if you're already logged in to the selected cluster — verified with one real API call first (not just "does the context name match"), so an expired session prompts you to log in again instead of handing you a broken one
  • Launch K9s on the selected context with one keypress
  • Live log console — pick a deployment (fetched straight from the Kubernetes API), tail every pod's logs via Stern, with:
    • live search + match highlighting
    • level-based coloring (errors/warnings stand out, key=value fields get highlighted too), plus a distinct color per pod so interleaved multi-pod output is easy to tell apart at a glance
    • line wrapping, click-drag mouse text selection with auto-copy-to-clipboard on release, manual reconnect on disconnect
  • Single static .exe, no runtime to install, ASCII-only rendering so it works over RDP/legacy consoles too
    • mouse selection is implemented by KubeConnect itself (not the terminal's native selection), so it works the same way regardless of console settings; if your terminal supports it, Shift+drag still falls back to the terminal's own native selection as an extra option

Requirements

  • Windows
  • kubectl-vsphere, k9s, and optionally stern available on PATH (or configured explicitly — see below)
  • Go 1.26+ if building from source (see go.mod)

Quick start

git clone https://github.com/nuwandev/KubeConnect.git
cd KubeConnect
Copy-Item config/environments.example.json config/environments.json
# edit config/environments.json with your own cluster details
go build -o KubeConnect.exe ./cmd/kubeconnect
.\KubeConnect.exe

Or build a ready-to-deploy folder (KubeConnect.exe + a kc launcher shim):

./scripts/build.ps1

Configuration

Everything lives in environments.json — no rebuild required to add a cluster, change a namespace, or tweak a timeout.

{
  "serverDefaults": {
    "insecureSkipTlsVerify": true,
    "loginTimeoutSeconds": 60
  },
  "toolPaths": {
    "kubectlVsphere": null,
    "k9s": null,
    "stern": null
  },
  "k9sDefaults": {
    "view": "deploy"
  },
  "logs": {
    "defaultTail": 100,
    "bufferSize": 10000,
    "apiTimeoutSeconds": 15
  },
  "environments": [
    {
      "name": "EXAMPLE DEV",
      "server": "vcenter.example.internal",
      "username": "svc-account@vsphere.local",
      "namespace": "example-dev-ns",
      "cluster": "example-dev-cluster",
      "context": "example-dev-cluster",
      "enabled": true
    }
  ]
}
Field What it does
serverDefaults.insecureSkipTlsVerify Passes --insecure-skip-tls-verify to kubectl-vsphere login
serverDefaults.loginTimeoutSeconds How long a login attempt may run before timing out (default 60)
toolPaths.* Explicit paths to kubectl-vsphere/k9s/stern, or null for auto-detection (app folder, then PATH)
k9sDefaults.view Resource k9s opens on ("deploy", "pods", ...), or null for its own default
logs.defaultTail / logs.bufferSize / logs.apiTimeoutSeconds Log viewer tunables — history replayed on open, in-memory line cap, API call timeout
environments[] One entry per cluster: name, server, username, namespace, cluster, context, enabled

toolPaths.k9s/toolPaths.stern are resolved lazily, the first time you actually use them — a missing/misconfigured one never blocks login.

Keyboard shortcuts

Everywhere: type to filter a list · Enter/Right confirm · Esc/Left back out · Ctrl+C cancel/exit

Log viewer: / search (highlights matches) · f jumps to the live tail and resumes following (scrolling is what pauses -- there's no separate pause key) · Up/Down/PgUp/PgDn/Home scroll (and pause) · c clear · :q quit · R reconnect after a disconnect · click-drag to select text (auto-copies to clipboard on release, shows Copied/Copy failed in the top bar) · mouse wheel scrolls and pauses following, same as the arrow keys

Security notes

  • The vSphere password only ever reaches kubectl-vsphere's child process via an environment variable — never a command-line argument, never written to disk or logged
  • No shell is invoked to run kubectl-vsphere/k9s/stern — arguments go straight through exec.Command's argv
  • environments.json is treated strictly as data, never executed

Development

go build ./...              # build
go test ./...                # run tests
gofmt -l . ; go vet ./...    # should both be clean

See CLAUDE.md for a deeper architecture tour if you're extending it.

About

Internal Windows CLI for logging into VMware Tanzu Kubernetes clusters, launching K9s, and tailing live pod logs — one keyboard-driven menu instead of copy-pasting kubectl-vsphere commands.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages