SSH into a running Container on Minikube

If you only need to forward some exposed container ports out of Minikube so they are accessible on your host machine, you can run an SSH tunnel. This is useful if you are using Minikube as a Docker Desktop replacement and aren’t running K8s services.

For example, forward traffic on exposed container port 8000 to the host machine on port 8000:

ssh -g -L 8000:localhost:8000 -N -i ~/.minikube/machines/minikube/id_rsa docker@$(minikube ip)