Getting this error when I try to knife bootstrap on chef-workstation


#1

root@chefwork:~/.chef# knife bootstrap 172.31.219.206 -x jay -A --sudo -N chefnode
Node chefnode exists, overwrite it? (Y/N) y
Client chefnode exists, overwrite it? (Y/N) y
Creating new client for chefnode
Creating new node for chefnode
Connecting to 172.31.219.206
jay@172.31.219.206’s password:
172.31.219.206 knife sudo password:
Enter your password:
172.31.219.206
172.31.219.206 -----> Existing Chef installation detected
172.31.219.206 Starting the first Chef Client run…
172.31.219.206 [2017-03-14T12:37:28-07:00] INFO: Forking chef instance to converge…
172.31.219.206 Starting Chef Client, version 12.19.36
172.31.219.206 [2017-03-14T12:37:28-07:00] INFO: *** Chef 12.19.36 ***
172.31.219.206 [2017-03-14T12:37:28-07:00] INFO: Platform: x86_64-linux
172.31.219.206 [2017-03-14T12:37:28-07:00] INFO: Chef-client pid: 3589
172.31.219.206
172.31.219.206 ================================================================================
172.31.219.206 Chef encountered an error attempting to load the node data for "chefnode"
172.31.219.206 ================================================================================
172.31.219.206
172.31.219.206 Unexpected API Request Failure:
172.31.219.206 -------------------------------
172.31.219.206 Cannot fetch the contents of the response.
172.31.219.206
172.31.219.206 Platform:
172.31.219.206 ---------
172.31.219.206 x86_64-linux
172.31.219.206
172.31.219.206
172.31.219.206 Running handlers:
172.31.219.206 [2017-03-14T12:38:49-07:00] ERROR: Running exception handlers
172.31.219.206 Running handlers complete
172.31.219.206 [2017-03-14T12:38:49-07:00] ERROR: Exception handlers complete
172.31.219.206 Chef Client failed. 0 resources updated in 01 minutes 20 seconds
172.31.219.206 [2017-03-14T12:38:49-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
172.31.219.206 [2017-03-14T12:38:49-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
172.31.219.206 [2017-03-14T12:38:49-07:00] ERROR: 504 "Gateway Timeout"
172.31.219.206 [2017-03-14T12:38:49-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)


#2

Either your chef server is broken/misconfigured/etc. or some proxy between your node and the Chef Server is causing the error. Since knife is making successful API requests it’s more likely to be the second option.


#3

Thank you for the reply. I have put no_proxy for all the chef components in my lab. This is the output of the chef-stacktrace.out

jay@chefnode:/etc/chef$ sudo cat /var/chef/cache/chef-stacktrace.out
Generated at 2017-03-14 14:04:14 -0700
Net::HTTPFatalError: 504 “Gateway Timeout”
/opt/chef/embedded/lib/ruby/2.3.0/net/http/response.rb:120:in error!' /opt/chef/embedded/lib/ruby/2.3.0/net/http/response.rb:129:invalue’
/opt/chef/embedded/lib/ruby/2.3.0/net/http.rb:920:in connect' /opt/chef/embedded/lib/ruby/2.3.0/net/http.rb:863:indo_start’
/opt/chef/embedded/lib/ruby/2.3.0/net/http.rb:852:in start' /opt/chef/embedded/lib/ruby/2.3.0/net/http.rb:1398:inrequest’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http/basic_client.rb:70:in request' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http.rb:340:inblock in send_http_request’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http.rb:372:in block in retrying_http_errors' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http.rb:370:inloop’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http.rb:370:in retrying_http_errors' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http.rb:333:insend_http_request’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http.rb:148:in request' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/http.rb:115:inget’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/node.rb:581:in load' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/node.rb:565:infind_or_create’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/policy_builder/dynamic.rb:72:in load_node' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:468:inload_node’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/client.rb:270:in run' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:295:inblock in fork_chef_client’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:283:in fork' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:283:infork_chef_client’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:248:in block in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/local_mode.rb:44:inwith_server_connectivity’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:236:in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:464:insleep_then_run_chef_client’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:451:in block in interval_run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:450:inloop’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:450:in interval_run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application/client.rb:434:inrun_application’
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/application.rb:59:in run' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/bin/chef-client:26:in<top (required)>’
/usr/bin/chef-client:57:in load' /usr/bin/chef-client:57:in


#4

The stack trace won’t be very helpful in this situation. I’d start by watching the Chef Server logs (chef-server-ctl tail can help) to see if Chef Server actually gets the request. If Chef Server is actually returning the 504 response, you’ll want to dig in to what Chef Server is doing to see why. If not, your config to disable request proxying might be incorrect, you could double check the client.rb and/or run Chef Client with -l debug to get more info.