AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1079334
Accepted
Sebastian
Sebastian
Asked: 2021-10-02 11:07:41 +0800 CST2021-10-02 11:07:41 +0800 CST 2021-10-02 11:07:41 +0800 CST

Permission denied (publickey) - 使用 Kubespray 设置 Kubernetes 集群

  • 772

此问题来自以下文档How to deploy Kubernetes using Kubespray。我逐字逐句地遵循他们的文档并达到了这一点:

ansible -i inventory.ini -m ping all

这是文档中的上述命令

该文档概述了使用 Kubespray 和 Terraform 将 Kubernetes 部署到 UpCloud 的所有必要步骤。如前所述,我可以执行所有命令,直到点击命令:ansible -i inventory.ini -m ping all

Enter passphrase for key '/home/summer/.ssh/id_rsa':
kubespray-worker-2 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Permanently added '<IP address>' (ECDSA) to the list of known hosts.\r\nubuntu@<IP address>: Permission denied (publickey).",
    "unreachable": true
}

Enter passphrase for key '/home/summer/.ssh/id_rsa':
kubespray-worker-0 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Permanently added '<IP address>' (ECDSA) to the list of known hosts.\r\nConnection closed by <IP address> port 22",
    "unreachable": true
}

Enter passphrase for key '/home/summer/.ssh/id_rsa':
kubespray-worker-1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Permanently added '<IP address>' (ECDSA) to the list of known hosts.\r\nubuntu@<IP address>: Permission denied (publickey).",
    "unreachable": true
}
kubespray-master-0 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Permanently added '<IP address>' (ECDSA) to the list of known hosts.\r\nubuntu@<IP address>: Permission denied (publickey).",
    "unreachable": true
}

以上图片形式错误,供进一步参考

请注意:隐藏在白色墨水中的区域是分配给上图中每个节点的公共 IP 地址。

我可以通过点击远程访问 Ubuntu 服务器:ssh <username>@<ip_address>. 这是一个快照,cluster-settings.tfvars看看我是否搞砸了一些东西:

zone     = "fe-fxfx"
username = "ubuntu"

# Prefix to use for all resources to separate them from other resources
prefix = "kubespray"

inventory_file = "inventory.ini"

#  Set the operating system using UUID or exact name
template_name = "Ubuntu Server 20.04 LTS (Focal Fossa)"

ssh_public_keys = [
  # Put your public SSH key here
  "removed the Public Key for security reasons",
]

此外,cluster-settings,tfvars文件中的图像供参考: cluster-settings.tfvars

ping 节点的结果也是不规则的,从某种意义上说,如果master-0在一个实例中成功 ping,在另一个实例中,它们都没有被 ping [再次尝试时]。虽然,有时worker-2被 ping 通,而休息则没有。

ssh ping ansible
  • 1 1 个回答
  • 662 Views

1 个回答

  • Voted
  1. Best Answer
    Sebastian
    2021-10-04T12:01:22+08:002021-10-04T12:01:22+08:00

    在咨询了一位前辈之后,我找到了这个问题的答案。首先,SSH 密钥对需要在没有密码的情况下生成,或者如果您使用的是带有密码的密钥对,只需传递以下命令即可禁用它:

    ssh-keygyen使用-p选项运行。

    ssh-keygen -p
    

    我建议您在 SSH 密钥对所在的目录中执行此操作,或者使用-f ~/<username>/.ssh/id_rsa

    如果您正确执行了上述步骤,则会提示您输入现有密码:

    Enter old passphrase:
    

    之后,输入新的密码[基本上留空]并确认:

    Enter new passphrase (empty for no passphrase):
    Enter same passphrase again:
    

    如果成功,您将收到以下提示:

    Your identification has been saved with the new passphrase.
    

    注意:这些步骤可用于删除或更改密码。

    Next 在cluster-settings.tfvars文件中,有两个地方可以"enter your SSH key here"选择输入您的公钥。两者都不是强制性的。就我而言,我只使用了一个公钥,并确保密钥对在 SSH 代理中可用。

    • 0

相关问题

  • 如何最好地设置 ssh 隧道以访问远程网络 (Linux)

  • SSH 和重定向

  • 通过 SSH 会话使用 NET USER 命令拒绝访问

  • SSH 服务器零日漏洞利用 - 保护自己的建议

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve