Run the CLI in a container
The laptop CLI reads your kubeconfig and sees requests it diverts. Running it in a container places a VM or container boundary around the process and lets you control which files and networks it can access.
The published laptop image is:
ghcr.io/flaticols/outprobe:latestThis is separate from ghcr.io/flaticols/outprobe-relay:v0.0.16, which runs in the cluster.
Two connections must cross the boundary
Section titled “Two connections must cross the boundary”- CLI → local app. Inside a container,
localhostis the container, not the host. OverrideLOCAL_TARGETwith a host-access name. - CLI → Kubernetes API. The in-process port-forward uses ordinary outbound API traffic. It usually works directly unless the API is reachable only through a host VPN.
Start the system and create a host-access DNS name once:
container system startsudo container system dns create host.container.internal --localhost 203.0.113.113Apple container mounts your macOS home into its Linux VM at the same paths. From the project directory:
container run --rm -it \ --workdir "$PWD" \ --env KUBECONFIG="$HOME/.kube/config" \ --env LOCAL_TARGET=http://host.container.internal:8080 \ ghcr.io/flaticols/outprobe:latest upKUBECONFIG is explicit because the image runs as root and its own home is /root. LOCAL_TARGET overrides the shared config only inside the container.
Docker Desktop provides host.docker.internal and does not share your home automatically. Bind only what the CLI needs:
docker run --rm -it \ -v "$HOME/.kube:/root/.kube:ro" \ -v "$PWD:/work:ro" -w /work \ -e LOCAL_TARGET=http://host.docker.internal:8080 \ ghcr.io/flaticols/outprobe:latest upMounting the kubeconfig at /root/.kube lets client-go use its default location. The read-only project mount still exposes .outprobe.yaml and custom .outprobe/ manifests.
On Docker Engine for Linux, add:
--add-host=host.docker.internal:host-gatewayCloud kubeconfig credential plugins
Section titled “Cloud kubeconfig credential plugins”Use one of these approaches:
- a self-contained token- or certificate-based kubeconfig for the isolated run;
- a custom CLI image containing the Linux build of the required credential plugin;
- a credential helper reachable and executable inside the container.
Host VPNs
Section titled “Host VPNs”If the Kubernetes API is reachable only over a VPN running on the host, the container may not inherit that route. Configure the runtime’s host-access networking, run the VPN inside the VM/container, or use a kube API endpoint reachable from the container network.
Apple networking notes
Section titled “Apple networking notes”Creating a --localhost DNS domain can disable iCloud Private Relay. The packet-filter rule may also disappear after a reboot, requiring the dns create command again. Consult the Apple container networking guide for current behavior.
Teardown behavior
Section titled “Teardown behavior”Keep the CLI in the foreground with --rm -it. Ctrl-C reaches outprobe, which removes routing first and then the relay before the container exits. If the runtime is killed ungracefully, run outprobe down with the same kube context and namespace.