先看下 node 的 ip 地址
╰─➤ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
minikube Ready control-plane,master 4d21h v1.23.9 192.168.49.2 <none> Ubuntu 20.04.5 LTS 5.15.0-56-generic docker://20.10.20
然而间接登录 docker node 会失败!
╰─➤ ssh docker@192.168.49.2 130 ↵
The authenticity of host '192.168.49.2 (192.168.49.2)' can't be established.
ED25519 key fingerprint is SHA256:ro33I63Xaq6BtyS/kfcVpinWBDH8Tx7kNm2NWSNnMoM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.49.2' (ED25519) to the list of known hosts.
docker@192.168.49.2's password:
Permission denied, please try again.
docker@192.168.49.2's password:
Permission denied, please try again.
docker@192.168.49.2's password:
docker@192.168.49.2: Permission denied (publickey,password).
查了一下,能够不必账号密码,而是密钥对登录
╰─➤ cat ~/.minikube/machines/minikube/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAmn5Z5ss2Od/TG5mFMGHfhRUvvM2MqisUHBiX2fEw/LV0MDho
g+ieFKcLZJSIvr6bW+cIf09aqlQzH5RPbTBav5HoRknAuigxtJrV0RpTpIvHvBn5
EXJk6v2rVCHTlzvglF3Tb2phoZJDNyBEF2lXwwQmFe4ZdNa20+R+iVBgDmw/N/vz
EylhDw5Hrq+Q3op7mpJfrseiLTbUhFIhEiGRackBnlIudXEGVI8oMPQBLaVY9vpu
bcjH2j+1QR1PPNnrdjvThPmDj5sVgfk+aL95IjaL5/UNPDN2m0uxO1FMTW5CdhNh
dC0HL/10zO6Tkq/xJkGYr2fIBLh+N6xfUnqHGQIDAQABAoIBAHvGYwyPHoC7nAzu
sFCU+VlMIhTnsZzcKp5f7bkEjbTJQ68mYkXcZloxguUwQ2Zem2XD8YDd+Muh7duN
HR1jsjDtGuTFTg1XCouhyVBgAUdBXeKMBIo/1i6W0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XSsuuH39DhYQ12uiLmjk7qRMiOynVRXKF2uF7MVkTw==
-----END RSA PRIVATE KEY-----
指定公钥地址,就能够了
╰─➤ ssh -i ~/.minikube/machines/minikube/id_rsa docker@192.168.49.2
docker@minikube:~$
docker@minikube:~$
参考:How do I ssh into the VM for Minikube?