使用Chef 12,Chef Client无法连接到chef服务器

时间:2014-12-31 12:15:01

标签: chef

命令我跑了:

knife bootstrap 10.x.x.x-x ec2-x-i xx.pem --sudo -r "role[x]"`

错误:

[2014-12-31T12:07:53+00:00] ERROR: Connection refused connecting to https://chefserver.dsh.com/organizations/digital/clients, retry 1/5`

日志显示:

Chef encountered an error attempting to create the client "ip-10-x-x-x.ec2.internal"`

到目前为止,我已经厌倦了:

  • 编辑我的knife.rb
  • chef_server_url从Chef Server的FQDN到IP地址

现在我得到了不同的错误:

Original Exception: OpenSSL::SSL::SSLError: hostname "10.x.x.x" does not match the server certificate`

3 个答案:

答案 0 :(得分:3)

SSL证书中的主机名与您使用的IP地址不匹配。

chefserver.dsh.com 是否已解析为该实例的IP地址?

您必须使用主机名(仍然忽略自签名证书)或完全禁用SSL证书验证。 Thisthis可以提供帮助。

答案 1 :(得分:2)

在Chef服务器上:

  • 我已将我的主机名从chefserver.dsh.com更改为 https://IPAddress
  • $ sudo chef-server-ctl reconfigure

在Chef WorkStation上:

  • 将工作站@chef_server_url上的knife.rb编辑为 https://IPAddress:443/organizations/name
  • $ sudo knife ssl fetch

答案 2 :(得分:0)

当我遇到相同的错误时,我发现以下步骤对AWS上的多个实例非常有用。通过这些步骤,您不必基于ipaddress来重新配置服务器。

在AWS上,有时您会看到ip-10-x-x-x之类的内容作为公共主机名,而没有ec2.internal部分(来自元数据端点)。在这种情况下,您只需在工作站上添加条目

ipaddress ip-10-x-x-x

到本地/ etc / hosts。

这将允许对https://ip-10-x-x-x/organizations(您的厨师服务器URL)的DNS调用被路由到该ipaddress(以防您的直接DNS路由不起作用),并允许进行SSL握手,以使刀工作从本地开始,而无需使用ipaddress重新配置您的Chef服务器