Minikube’s SSH functionality is less about direct node access and more about a controlled gateway into the containerized environment that simulates a node.

Let’s see it in action. Imagine you’ve got a minikube cluster running and you need to poke around.

minikube ssh "ls -l /etc/kubernetes/"

This command doesn’t just run ls -l /etc/kubernetes/ on your local machine. It initiates an SSH connection into the minikube virtual machine (or container, depending on your driver), executes the command there, and then prints the output back to your terminal.

The Mental Model

Minikube, by default, runs Kubernetes inside a lightweight virtual machine or container. This VM/container acts as your "cluster node." When you use minikube ssh, you’re not directly SSHing into a bare-metal server or a full-blown VM that you manage separately. Instead, you’re using the minikube tool itself to establish a secure channel into that specific, managed environment.

The problem this solves is providing a convenient, isolated Kubernetes development environment without the overhead of setting up a full cloud cluster or managing multiple VMs. You get a single-node Kubernetes cluster that’s easy to start, stop, and manage, and minikube ssh is your primary tool for interacting with the underlying "node" it runs on.

You control the environment through minikube’s commands:

  • minikube start: Boots up the cluster.
  • minikube stop: Shuts it down.
  • minikube delete: Removes it entirely.
  • minikube ssh <command>: Executes a command inside the minikube VM.
  • minikube kubectl -- <kubectl command>: A shortcut to run kubectl commands against your minikube cluster.

Internally, minikube ssh leverages your system’s SSH client (like OpenSSH) to connect to a pre-configured SSH server running within the minikube VM. Minikube handles the IP address, port, and authentication details for you, making it a seamless experience. The command minikube ssh essentially translates to something like ssh docker@<minikube-vm-ip> -p <minikube-vm-ssh-port> -- <your-command>.

The Levers

The primary lever you have is the command you pass to minikube ssh. This is where you can inspect system files, check running processes, or even manually manipulate files within the minikube VM. For example, to see the disk usage inside your minikube VM:

minikube ssh "df -h"

Or to inspect the logs of the kubelet running on the minikube node:

minikube ssh "sudo journalctl -u kubelet"

The sudo is often necessary because many system-level operations within the minikube VM require elevated privileges.

The minikube ssh command is your direct line to the Linux environment where your Kubernetes components are running. It’s invaluable for debugging issues that aren’t immediately apparent through kubectl or pod logs. You can check network configurations, firewall rules (if applicable to the VM), or the status of system services.

When you run minikube start with a specific driver, like docker, virtualbox, or qemu2, minikube sets up an environment appropriate for that driver. For Docker, it’s often a minimal Linux container. For VirtualBox or QEMU, it’s a full VM. Regardless of the driver, minikube configures an SSH server within that environment and registers its connection details so the minikube ssh command knows where to go.

The magic happens because minikube manages the lifecycle of this VM or container. It ensures the SSH server is running and accessible on a specific IP and port that minikube ssh can discover. You don’t need to manually configure SSH keys or know the VM’s IP address; minikube abstracts all of that away. This makes it incredibly easy to jump into the node’s environment for debugging.

The most surprising thing is that minikube ssh doesn’t actually use a persistent SSH daemon in the same way a traditional server does. When you run minikube start, minikube provisions the VM/container and ensures a process is listening on the SSH port. However, the connection details and the SSH key pair used are ephemeral and managed by minikube itself for that specific instance of the cluster. If you restart minikube, the VM/container is often recreated, and a new SSH session might be established with potentially different internal credentials managed by minikube.

Once you’re comfortable with minikube ssh, you’ll naturally want to understand how to manage the network traffic into your pods from outside the minikube VM.

Want structured learning?

Take the full Minikube course →