首页 > 解决方案 > 如何配置 minikube ssh?

问题描述

我正在尝试在 Ubuntu 18.04 上使用 kvm 启动 Kubernetes minikube (v0.32.0)

https://kubernetes.io/docs/setup/minikube/

但是,它在运行时挂起 :minikube start --vm-driver kvm2 -v 10minikube ssh -v 10

Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain.

我可以使用“ssh docker@192.168.39.98”连接到 minikube VM,所以我相信minikube ssh它不起作用,因为它不使用相同的参数。我如何配置它来做到这一点?

"AuthOptions": {
            "CertDir": "/home/badgers/.minikube",
            "CaCertPath": "/home/badgers/.minikube/certs/ca.pem",
            "CaPrivateKeyPath": "/home/badgers/.minikube/certs/ca-key.pem",
            "CaCertRemotePath": "",
            "ServerCertPath": "/home/badgers/.minikube/machines/server.pem",
            "ServerKeyPath": "/home/badgers/.minikube/machines/server-key.pem",
            "ClientKeyPath": "/home/badgers/.minikube/certs/key.pem",
            "ServerCertRemotePath": "",
            "ServerKeyRemotePath": "",
            "ClientCertPath": "/home/badgers/.minikube/certs/cert.pem",
            "ServerCertSANs": null,
            "StorePath": "/home/badgers/.minikube"

标签: ubuntusshkubernetes

解决方案


你的虚拟机真的启动了吗?您是在裸机还是嵌套虚拟化上运行?通常,您连接到 VM 的 ssh 私钥将位于:

/home/badgers/.minikube/machines/minikube/id_rsa

您可以通过以下方式进行检查:

$ minikube ssh-key

这也由SSHKeyPath您的配置中的选项标识:

{
    "ConfigVersion": 3,
    "Driver": {
        "IPAddress": "192.168.x.x",
        "MachineName": "minikube",
        "SSHUser": "docker",
        "SSHPort": 22,
        "SSHKeyPath": "/home/badgers/.minikube/machines/minikube/id_rsa",
        ...
}

推荐阅读