Skip to content
docker · rust · kubernetes · kubevirt

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.
kbve-kubectlApp
Alpine + muslBase
kbve/kubectlImage
RustCLI

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.

CommandDescription
kbve-kubectl infoPrint 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)
ToolPurpose
kubectlKubernetes API access (static binary)
curlHTTP requests
jqJSON processing
/bin/shShell script execution (Alpine ash)
kbve-kubectlStatic 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']

The image is pinned across every manifest in the deployment_yamls field above, all kept in sync on each publish. A representative sample:

ManifestJobPattern
apps/kube/kubevirt/autologon/job.yamlKubeVirt Windows autologon setupOne-shot Job, kubectl + virtctl
apps/kube/kubevirt/runner/job.yamlKubeVirt runner orchestrationOne-shot Job, kubectl + virtctl
apps/kube/agones/factorio/manifests/rotation-cronjob.yamlFactorio GameServer rotator + watchdogCronJob 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=180

Questions

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.