Chef:Bootstrapping节点时的身份验证错误

时间:2017-04-02 19:40:05

标签: chef knife

我是Chef的新手,我浏览了使用Vagrant管理节点的教程,但现在我正在尝试设置我的生产环境。我在引导节点时遇到问题。

厨师服务器设置正常,功能齐全。当我检查我的ssl时,它成功了:

Connecting to host $CHEF_SERVER_HOSTNAME$:443
Successfully verified certificates from `$CHEF_SERVER_HOSTNAME$'

我可以上传食谱和角色。所以我假设我的厨师服务器设置正确。

问题是,当我引导节点时,我收到验证错误,说该节点无法与Chef服务器通信(收到401错误)

用于引导节点的示例命令:

knife bootstrap $NODE_IP$ --ssh-port 22 --ssh-user $NODE_USER$  --ssh-password $NODE_USER_PASS$ --sudo --use-sudo-password  --node-name node-1 --run-list 'role[some-role]'

我得到以下堆栈跟踪

[sudo] password for manager: -----> Existing Chef installation detected
Starting the first Chef Client run...
[2017-04-02T21:35:19+02:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 12.19.36
[2017-04-02T21:35:19+02:00] INFO: *** Chef 12.19.36 ***
[2017-04-02T21:35:19+02:00] INFO: Platform: x86_64-linux
[2017-04-02T21:35:19+02:00] INFO: Chef-client pid: 5271
Creating a new client identity for node-1 using the validator key.
[2017-04-02T21:35:21+02:00] INFO: Client key /etc/chef/client.pem is not present - registering
[2017-04-02T21:35:22+02:00] INFO: HTTP Request Returned 401 Unauthorized: error

================================================================================
Chef encountered an error attempting to create the client "node-1"
================================================================================

Authentication Error:
---------------------
Failed to authenticate to the chef server (http 401).

Server Response:
----------------
Failed to authenticate as 'chef-validator'. Ensure that your node_name and client key are correct.

Relevant Config Settings:
-------------------------
chef_server_url         "https://$CHEF_SERVER$/organizations/pds"
validation_client_name  "chef-validator"
validation_key          "/etc/chef/validation.pem"

If these settings are correct, your validation_key may be invalid.

Platform:
---------
x86_64-linux


Running handlers:
[2017-04-02T21:35:22+02:00] ERROR: Running exception handlers
Running handlers complete
[2017-04-02T21:35:22+02:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 03 seconds
[2017-04-02T21:35:22+02:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2017-04-02T21:35:22+02:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-04-02T21:35:22+02:00] ERROR: 401 "Unauthorized"
[2017-04-02T21:35:22+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

我尝试删除validation.pem文件并重新运行命令,但我得到了相同的结果。

我在这里迷路了,我该怎么办?

1 个答案:

答案 0 :(得分:0)

作为厨师工作站设置的一部分,您应该将.pem文件从chef服务器复制到工作站。你做了那个步骤吗?