Minikube
agentfile can start a Minikube cluster and make it accessible to the agent
container via a built-in TCP forwarder — no socat required.
Prerequisites
Typical workflow
--minikube automatically prepares the Minikube kubeconfig for use inside the
container. Because the container runs rootless and isolated from the host
network, a plain copy of ~/.kube/config won't work. The certificate paths
and server address need to be adjusted first.
agentfile handles this automatically. It extracts the minikube context from
your kubeconfig, embeds any referenced certificate files directly, and rewrites
the server address to one reachable from inside the container. The result is
mounted at /root/.kube/config and cleaned up when the container exits.
In one terminal, start Minikube and the port forwarder:
agentfile minikube start
In a second terminal, run the agent with the kubeconfig mounted automatically:
agentfile run --minikube
agentfile minikube start
Starts Minikube if it isn't already running (or unpauses it if it is paused), then forwards the ephemeral apiserver port to a fixed port on all interfaces so the container can reach it. Blocks until Ctrl-C.
The defaults work for most setups. Override them if needed:
| Flag | Default | Description |
|---|---|---|
--host |
169.254.1.2 |
IP passed to --apiserver-ips and used as the forward destination |
--port |
16443 |
Port to listen on for the TCP forwarder |
--driver |
qemu2 |
Minikube driver (passed to --driver on start) |
agentfile minikube kubeconfig
Generates the filtered kubeconfig that --minikube produces automatically.
Useful for inspecting the output, saving it somewhere persistent, or using it
outside of agentfile run.
# Print to stdout
agentfile minikube kubeconfig
# Write to a file
agentfile minikube kubeconfig -o /tmp/minikube.yaml
| Flag | Default | Description |
|---|---|---|
-n/--name |
minikube |
Context/cluster/user name to keep |
-s/--server |
https://169.254.1.2:16443 |
Override the cluster server URL |
-o/--output |
- (stdout) |
Output file path |
--kubeconfig |
$KUBECONFIG or ~/.kube/config |
Source kubeconfig file |