2017-04-02 75 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文件從廚師服務器複製到工作站。你做了那一步?