明明配置IP正常,其他都没问题,目标机器就是无法通过ansible访问.

在这里插入图片描述

ansible k8s-node1 -m ping
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths , use [defaults]
inventory=/path/to/file|dir instead. This feature will be removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
k8s-node1 | UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh: root@10.5.6.21: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).”,
“unreachable”: true
}

访问失败,

解决办法

ssh-copy-id root@k8s-node1

或 ssh-copy-id root@10.5.6.23

正常登陆一次,覆盖掉原来的ssh 信息,就正常了。
在这里插入图片描述

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐