How to ssh mini-kube or docker-desktop?

5/9/2021

I want to ssh minikube/docker-desktop, but I cant. How can i do that?

NAME       STATUS   ROLES                  AGE     VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
minikube   Ready    control-plane,master   4m47s   v1.20.2   192.168.49.2   <none>        Ubuntu 20.04.2 LTS   4.19.121-linuxkit   docker://20.10.6

ssh minikube
ssh: Could not resolve hostname minikube: nodename nor servname provided, or not known

I am learning K8s and able to ssh while working on K8s hands-on labs available online. I'd like t test some stuff on my local environment.

-- cosmos-1905-14
docker
kubernetes
minikube

1 Answer

5/9/2021

minikube is the node name within the Kubernetes API, not a hostname in this case. Minikube offers a wrapper minikube ssh command to automate pulling the IP and whatnot. Docker Desktop does not offer an official way to get a shell in the VM as it's a single-purpose appliance and they want it in a known state, but you can fake it by running a super-superuser container like docker run -it --rm --privileged --pid=host justincormack/nsenter1 to break out into the host namespaces.

-- coderanger
Source: StackOverflow