如何修复 Chef 中的 'knife bootstrap ssh connection to client issue'?

How to fix 'knife bootstrap ssh connection to client issue' in chef?

我正在尝试使用 knife 从 Chef 工作站添加 Chef 客户端节点 bootstrap command.But 收到错误消息 '''ERROR: Train::Transports::SSHFailed: SSH session could not be established'''

我在 Chef 客户端上禁用了 iptables

[root@chefclient ~]# service iptables status
Redirecting to /bin/systemctl status  iptables.service
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
   Active: inactive (dead)

Jul 29 16:21:18 chefclient.jp.com systemd[1]: [/usr/lib/systemd/system/iptables.service:5] Unknown lvalue 'AssertPathExists' in... 'Unit'
Hint: Some lines were ellipsized, use -l to show in full

'''knife bootstrap 192.168.56.6 -N chefclient.jp.com -U root --sudo -i /root/Downloads/chefsetup.pem'''

Getting result as:
Connecting to 192.168.56.6
WARN: [SSH] PTY requested: stderr will be merged into stdout
The authenticity of host '192.168.56.6 ()' can't be established.
fingerprint is SHA256:8x0e7QPub3Zj/2GFz5XSFZCABEbez6uVV/eR1MvYoIE.

Are you sure you want to continue connecting
? (Y/N) Y
WARN: [SSH] PTY requested: stderr will be merged into stdout
WARN: [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user root@192.168.56.6>)
ERROR: Train::Transports::SSHFailed: SSH session could not be established

从 Chef 服务器 webui 下载 knife.rb 文件,organization-validator.pem 并保存在 Chefstation 上的 .chef 目录和 运行 刀 bootstrap命令如下

'''knife bootstrap 192.168.56.6 -N chefclient.jp.com -U root'''

输出:

Connecting to 192.168.56.6
WARN: [SSH] PTY requested: stderr will be merged into stdout
The authenticity of host '192.168.56.6 ()' can't be established.
fingerprint is SHA256:8x0e7QPub3Zj/2GFz5XSFZCABEbez6uVV/eR1MvYoIE.

Are you sure you want to continue connecting
? (Y/N) Y
WARN: [SSH] PTY requested: stderr will be merged into stdout
Performing legacy client registration with the validation key at /root/chef-repo/.chef/short_name-validator.pem...
                                                                                                           Delete your validation key in order to use your user credentials for client registration instead.
Bootstrapping 192.168.56.6
 [192.168.56.6] -----> Installing Chef Omnibus (stable/15)
downloading https://omnitruck.chef.io/chef/install.sh
......................................................
......................................................

[192.168.56.6] Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io
 [192.168.56.6] Starting the first Chef Infra Client Client run...
 [192.168.56.6] Starting Chef Infra Client, version 15.1.36
 [192.168.56.6] Creating a new client identity for chefclient.jp.com using the validator key.
 [192.168.56.6] resolving cookbooks for run list: []
 [192.168.56.6] Synchronizing Cookbooks:
 [192.168.56.6] Installing Cookbook Gems:
Compiling Cookbooks...
[2019-07-30T13:12:01+05:30] WARN: Node chefclient.jp.com has an empty run list.
 [192.168.56.6] Converging 0 resources

这有帮助

ssh-keyscan host-ip-address >> $HOME/.ssh/known_hosts