Unable to Bootstrap node using Chef

2019-07-06 03:50发布

问题:

I've set up a basic Chef infrastructure that contains a workstation, a hosted Chef Server and an Ubuntu Server to serve as a node. I'm using this setup at my workplace and therefore a proxy is required for internet connections. I've made the necessary proxy settings in both knife.rb and the Ubuntu Server. Both the workstation and the node are properly connected to the internet. Here's the problem - When I try to bootstrap this node using knife, I get the following error:

<My Node's IP> --2014-02-12 10:29:05--  https://www.opscode.com/chef/install.sh
<My Node's IP> Resolving www.opscode.com (www.opscode.com)... 184.106.28.91
<My Node's IP> Connecting to www.opscode.com (www.opscode.com)|184.106.28.91|:443... failed: Connection refused.
<My Node's IP> bash: line 83: chef-client: command not found

Please note that I used the following command to bootstrap the node -

knife bootstrap <My Node's IP> --sudo -x <username> -P <password> -N <name> 

Can you please help me with this? Thanks in advance.

回答1:

After struggling on this for a long time I have finally found the answer. In knife.rb another entry for bootstrap-proxy has to made as well.

knife[:bootstrap_proxy] = "http://username:password@proxy:port"

After doing this, run the following bootstrap command -

knife bootstrap <My Node's IP> --sudo -x <username> -P <password> -N <name>

This worked for me!



回答2:

I have encountered the same problem. You just need to type the same thing with some extra commands:

knife bootstrap <My Node's IP> --sudo -x <username> -P <password> -N <name> --bootstrap-wget-options --no-check-certificate

It will work always.



回答3:

In my case, I didn't added the server in client's hosts file entry. for example, I got this error "Connection refused - Connection refused connecting to https://server.com/organizations/sample/nodes/node1" I simple made an entry in "/etc/hosts" file with my server's IP and name i.e "server.com" and it worked for me.

vi /etc/hosts

192.168.159.100 server.com