Alpine musl kubectl with aRust CLI
An Alpine + musl kubectl container image with Rust CLI extensions for KubeVirt VM lifecycle management and Agones GameServer rotation. Built end-to-end on rust:alpine so the binary has zero glibc dependencies, it replaces the distroless kubectl image that lacks /bin/sh.
Shell-capable by design
The distroless registry.k8s.io/kubectl image lacks /bin/sh and breaks Kubernetes Job scripts. This image ships Alpine ash plus a static musl Rust CLI, so Jobs can run shell and drive KubeVirt VMs from one artifact.
- guest-exec — run commands inside a KubeVirt VM.
- rotate-gameserver — roll a drifted Agones GameServer.
What it gives you
Features
Shell-capable image
Ships /bin/sh (Alpine ash) so Kubernetes Job scripts run, unlike the distroless upstream.
Static musl Rust CLI
kbve-kubectl is built on rust:alpine with zero glibc dependencies.
guest-exec into VMs
Runs commands inside a KubeVirt VM via the QEMU Guest Agent.
rotate-gameserver
Rolls an Agones GameServer when its desired image drifts from the running pod (delete-only; ArgoCD recreates).
Pinned across manifests
One image tag is kept in sync across every manifest in the deployment_yamls field via the post-publish version sync.
Reference
CLI & bundled tools
Alpine-based kubectl image with a static musl Rust CLI wrapper for KubeVirt VM management. Replaces the distroless registry.k8s.io/kubectl image which lacks /bin/sh and breaks Kubernetes Job scripts. Built end-to-end on rust:alpine so the binary has zero glibc dependencies.
CLI Subcommands
Section titled “CLI Subcommands”| Command | Description |
|---|---|
kbve-kubectl info | Print version and check available tools |
kbve-kubectl run <script> | Execute a shell script (passthrough to /bin/sh) |
kbve-kubectl guest-exec --vm <name> --command <cmd> | Run a command inside a KubeVirt VM via QEMU Guest Agent |
kbve-kubectl rotate-gameserver --namespace <ns> --gameserver <name> | Roll an Agones GameServer when its desired image drifts from the running pod image (delete-only; ArgoCD recreates) |
Bundled Tools
Section titled “Bundled Tools”| Tool | Purpose |
|---|---|
kubectl | Kubernetes API access (static binary) |
curl | HTTP requests |
jq | JSON processing |
/bin/sh | Shell script execution (Alpine ash) |
kbve-kubectl | Static musl Rust CLI |
Jobs
Usage in Jobs
containers: - name: task image: ghcr.io/kbve/kubectl:0.1.0 command: ['/bin/sh', '/scripts/my-script.sh']Where it ships
Section titled “Where it ships”The image is pinned across every manifest in the deployment_yamls field above, all kept in sync on each publish. A representative sample:
| Manifest | Job | Pattern |
|---|---|---|
apps/kube/kubevirt/autologon/job.yaml | KubeVirt Windows autologon setup | One-shot Job, kubectl + virtctl |
apps/kube/kubevirt/runner/job.yaml | KubeVirt runner orchestration | One-shot Job, kubectl + virtctl |
apps/kube/agones/factorio/manifests/rotation-cronjob.yaml | Factorio GameServer rotator + watchdog | CronJob every 2 min, invokes kbve-kubectl rotate-gameserver to (a) compare gs.spec.image vs pod.spec.image and delete the GameServer on drift, and (b) detect state=Unhealthy with a missing pod and delete the stuck GameServer so ArgoCD selfHeal recreates from the spec |
When a new behavior needs to land across all rotator and KubeVirt jobs (RCON-aware save-flush probes, Agones SDK Health calls, retry-with-backoff, ConfigMap-driven rotation policy), extend the Rust CLI in apps/vm/kubectl/src/, bump version.toml, and every manifest above auto-bumps via the post-publish sync.
Or using the Rust CLI directly:
containers: - name: task image: ghcr.io/kbve/kubectl:0.1.0 command: ['kbve-kubectl', 'guest-exec'] args: ['--vm', 'windows-builder', '--command', 'powershell.exe']GameServer rotator using the Rust CLI directly:
containers: - name: rotator image: ghcr.io/kbve/kubectl:0.1.2 command: - kbve-kubectl - rotate-gameserver - --namespace=factorio - --gameserver=factorio - --container=factorio - --delete-timeout=180Questions
Frequently asked
What is the KBVE kubectl image?
It is an Alpine-based kubectl image with a static musl Rust CLI wrapper for KubeVirt VM management. It replaces the distroless registry.k8s.io/kubectl image, which lacks /bin/sh and breaks Kubernetes Job scripts.
What can the kbve-kubectl CLI do?
The Rust CLI offers info to print versions and check tools, run to execute shell scripts, guest-exec to run commands inside a KubeVirt VM via the QEMU Guest Agent, and rotate-gameserver to roll an Agones GameServer when its desired image drifts from the running pod.
How is the kubectl image kept in sync across manifests?
The image tag is pinned across every manifest listed in the deployment_yamls frontmatter field, and all of them auto-bump on each publish via the post-publish version sync.
