2016-12-13 40 views
0

我有3個組件:節點,服務器和工作站。我沒有設置這些。我可以從工作站運行裁刀狀態,並返回當前結果(我相信這證實了從工作站到服務器的連接)。我可以成功地從節點本身運行chef-client(我相信這證實了從節點到服務器的連接+清楚地表明它已經被引導)。節點連接到廚師服務器,工作站連接廚師服務器,但引導相同的節點失敗

但嘗試再次引導失敗。我發現奇怪的一件事是,我注意到工作站上的/etc/chef/client.rb文件將其node_name行替換爲我試圖啓動的節點的名稱。也許這很正常?

我不能理清的一件事是,這個錯誤使得它看起來像/ someone /無法連接到廚師服務器;但是,如上所述,我確認工作站和節點都可以授權並連接到廚師服務器。

我一直在瀏覽文檔,但一個巨大的問題是模糊性。它會說「有些東西位於/etc/chef/client.rb」 - 確定,但在節點,服務器或工作站上?他們都有這個文件!

我認爲這可能是我的鑰匙,它在工作站上的〜/ .chef/knife.rb中用「client_key」這一行表示 - 但我不想改變它,以免我失去與服務器。但似乎很明顯,某處存在身份驗證故障 - 我只是在引導過程中找不到它。

[[email protected] chef]# cat client.rb 
log_location  STDOUT 
chef_server_url "https://chefserver/organizations/domain" 
validation_client_name "domain-validator" 
node_name "workstation" 
ssl_verify_mode :verify_none 
trusted_certs_dir "/etc/chef/trusted_certs" 

[[email protected] chef]# knife bootstrap node.domain.goes.here -N node -x user -i /home/user/.ssh/id_rsa --sudo --use-sudo-password --node-ssl-verify-mode none -r recipe[chef-client] 
Doing old-style registration with the validation key at ~/.keys/domain-validator.pem... 
Delete your validation key in order to use your user credentials instead 

Connecting to node.domain.goes.here 
node.domain.goes.here -----> Existing Chef installation detected 
node.domain.goes.here Starting the first Chef Client run... 
node.domain.goes.here Starting Chef Client, version 12.10.24 
node.domain.goes.here 
node.domain.goes.here ================================================================================ 
node.domain.goes.here Chef encountered an error attempting to load the node data for "node" 
node.domain.goes.here ================================================================================ 
node.domain.goes.here 
node.domain.goes.here Authentication Error: 
node.domain.goes.here --------------------- 
node.domain.goes.here Failed to authenticate to the chef server (http 401). 
node.domain.goes.here 
node.domain.goes.here Server Response: 
node.domain.goes.here ---------------- 
node.domain.goes.here Invalid signature for user or client 'node' 
node.domain.goes.here 
node.domain.goes.here Relevant Config Settings: 
node.domain.goes.here ------------------------- 
node.domain.goes.here chef_server_url "https://chefserver/organizations/domain" 
node.domain.goes.here node_name   "node" 
node.domain.goes.here client_key  "/etc/chef/client.pem" 
node.domain.goes.here 
node.domain.goes.here If these settings are correct, your client_key may be invalid, or 
node.domain.goes.here you may have a chef user with the same client name as this node. 
node.domain.goes.here 
node.domain.goes.here Platform: 
node.domain.goes.here --------- 
node.domain.goes.here x86_64-linux 
node.domain.goes.here 
node.domain.goes.here 
node.domain.goes.here Running handlers: 
node.domain.goes.here [2016-12-13T13:51:26-05:00] ERROR: Running exception handlers 
node.domain.goes.here Running handlers complete 
node.domain.goes.here [2016-12-13T13:51:26-05:00] ERROR: Exception handlers complete 
node.domain.goes.here Chef Client failed. 0 resources updated in 01 seconds 
node.domain.goes.here [2016-12-13T13:51:26-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out 
node.domain.goes.here [2016-12-13T13:51:26-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report 
node.domain.goes.here [2016-12-13T13:51:26-05:00] ERROR: 401 "Unauthorized" 
node.domain.goes.here [2016-12-13T13:51:26-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 

[[email protected] chef]# cat client.rb 
log_location  STDOUT 
chef_server_url "https:/chef/organizations/domain" 
validation_client_name "domain-validator" 
node_name "node" 
ssl_verify_mode :verify_none 
trusted_certs_dir "/etc/chef/trusted_certs" 

回答

1

您可能已經有一個客戶端在您的組織中與該名稱匹配。通過knife client delete刪除它。

1

我的理解是,你試圖用一個新名稱重新引導,這是行不通的。 該節點已經被引導,並且它已經有一個客戶端的client.pem文件,它的名字叫做old-name

廚師不會嘗試註冊名爲new_name(在您的問題中爲node)的新客戶端,因爲client.pem在這裏。但它將使用new_name,結果是客戶端new_name正在嘗試使用其他人的密鑰進行身份驗證。

對於廚師服務器,new_name不存在,所以它無法對其進行身份驗證。

我不確定爲什麼你想再次引導,所以兩個解決方案:

  1. 您要更改節點名稱,在這種情況下刪除該節點上的client.pem文件並運行你的引導再次命令。
  2. 你想在節點上再次運行廚師,在這種情況下使用任何你想要的,一個測試模型可以使用knife ssh -x user -i /home/user/.ssh/id_rsa 'name:old_name' 'sudo chef-client -r 'new_runlist'

要刪除client.pem,你可以通過ssh ssh來完成。

要在您的命令行中傳遞密碼,請參閱this Q/A on superuser,注意如果您沒有在空間中預先添加兩個命令,密碼將在進程列表和shell歷史記錄中可見。

相關問題