prince
prince

Reputation: 1

chef-client is not running while bootstraping from workstration or on a node

I have installed chef server package on linux server and also have one linux workstation and a linux node on AMAZON EC2.I am trying to run the following bootstrap command on workstation:

chef exec knife bootstrap 10.0.xx.xx -x ec2-user --sudo -i keyfile.pem --node-name Chef_Test_Node

But chef-client is not working on node. Getting below error:

----------------------------------------------------------------------
Network Error:

There was a network error connecting to the Chef Server: Error connecting to https://xx.xx.xx.xx/organizations/xxx/clients - getaddrinfo: Name or service not known
Relevant Config Settings:

chef_server_url "https://xx.xx.xx.xx/organizations/xxx"

If your chef_server_url is correct, your network could be down.
-----------------------------------------------------------------------

I am able to run knife client list or node list which proves that there is no issue with network from my workstation

Could you please let me know how can i resolve this issue.

Thanks

Upvotes: 0

Views: 1575

Answers (2)

ProfVersaggi
ProfVersaggi

Reputation: 886

I had this problem because I was running CHEF on a local LAN with out the benefit of a proper DNS service running, therefore I had to rely on the /etc/hosts file for the host name resolution. On the new node I added, I had forgotten to seed the /etc/hosts file with the entries that corresponded to each server in my Chef cluster so it couldn't resolve the "chef-server" name.

The FIX: Once I put the proper entries in the /etc/hosts file, everything ran like it should have.

    /etc/hosts:

127.0.0.1       localhost
192.168.1.165   chef-admin
192.168.1.160   chef-server
192.168.1.161   chef-node1
192.168.1.162   chef-node2
192.168.1.163   chef-node3
192.168.1.164   chef-node4

Upvotes: 1

jorfus
jorfus

Reputation: 3098

The proxy settings are set in the /etc/client.rb file on the client node (which of course you'll only have post bootstrap).

I don't think you want that. If you in fact have a NAT, HTTP proxy settings won't do you any good. Also you would still have to solve the chicken and egg bootstrap problem.

If you do in fact have an https proxy you could:

  • temporarily attach an elastic IP to your instance and bootstrap. (NOTE use a security group to only allow incoming on port 22 from your chef server)
  • Once you bootstrap you can remove the elastic IP and update the client.rb to point to your https proxy.

(NOTE also that amazon will charge you for having unattached elastic IPs)

If you do not have an http proxy but do in fact have a NAT you should do the following:

  • 1) Confirm workstation can execute knife commands on server (something like: knife user list )
  • 2) confirm server can ssh to client (if you have a nat you'd need an incoming forwarding rule to make this happen)
  • 3) confirm client can connect via https to server

Test with: curl -k https://server/organizations/organization_name

Once you know which connection is failing you can start to uncover the reason why.

Upvotes: 0

Related Questions