2017-04-02 69 views
0

我是厨师的新手,我使用Vagrant管理节点的教程,但现在我正在尝试设置我的生产环境。我遇到问题引导一个节点。厨师:引导节点时的身份验证错误

厨师服务器设置和功能。当我检查我的SSL,它的成功:

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

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

当我的Bootstrap一个节点我得到一个验证错误,称该节点无法与厨师服务器(得到一个401错误)

实例命令的Bootstrap一个节点进行通信的问题是:

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文件并重新运行该命令,但我得到同样的重SULT。

我很迷路,我该怎么办?

+0

您确定您的组织密钥有效吗?从12.2.0厨师可以bootstrap验证。它只是需要传递节点名称,你在做什么,是你的用户在管理组?另外IRC,validator_client_name默认为' -validator',所以在你的情况下'pds-validator'。 –

+0

401是认证失败的HTTP返回码。 @Szymon是正确的,你需要检查你的凭证 –

回答

0

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