RKE 集群常見問題排查


SSH 連接報錯

Failed to set up SSH tunneling for host [xxx.xxx.xxx.xxx]: Can't retrieve Docker Info

Failed to dial to /var/run/docker.sock: ssh: rejected: administratively prohibited (open failed)

  • 沒有訪問 Docker socket 的權限,請登錄主機,運行docker ps檢查權限:
ssh -i ssh_privatekey_file user@server
user@server$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES

請參考如何以非 root 用戶角色管理 Docker,正確配置您的權限。

  • 如果您使用的操作系統是 RedHat 或 CentOS,您不能使用 root 用戶連接節點,因為這兩種系統有這個 bugBugzilla #1527565。您需要添加一個用戶,然后為它配置訪問 Docker socket 的權限。詳情請參考RKE OS Requirements。

  • SSH server 的版本低於 v6.7。通過 SSH 連接 Docker socket 需要用到 v6.7 或以上的 SSH server。您可以運行sshd -V命令檢查當前主機使用的 SSH server 版本,或使用 netcat 命令檢查 SSH server 版本,如下方示例代碼所示,請將“xxx.xxx.xxx.xxx”替換為主機 IP 地址:

nc xxx.xxx.xxx.xxx 22
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.10

Failed to dial ssh using address [xxx.xxx.xxx.xxx:xx]: Error configuring SSH: ssh: no key found

  • 無法訪問密鑰文件ssh_key_path。請檢查您是否已經指定了密鑰文件,檢查執行 rke 命令的用戶是否有權限訪問這個密鑰文件。

  • 密鑰文件ssh_key_path異常。運行ssh-keygen -y -e -f private_key_file命令,檢查密鑰文件是否有效。該命令的返回消息包括了公鑰和私鑰,如果私鑰失效,該命令會返回報錯消息。

Failed to dial ssh using address [xxx.xxx.xxx.xxx:xx]: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

  • 密鑰文件ssh_key_path不正確。請檢查節點使用的密鑰文件是否為ssh_key_path,然后檢查您是否指定了正確的用戶使用這個密鑰通過 SSH 連接。

Failed to dial ssh using address [xxx.xxx.xxx.xxx:xx]: Error configuring SSH: ssh: cannot decode encrypted private keys

  • 如果您想使用加密的私鑰,您應該使用ssh-agent命令加載密鑰和密鑰短語(passphrase)。您可以在命令行工具輸入--ssh-agent-auth命令,配置 RKE 使用這個 agent。它會在運行rke命令的環境中使用SSH_AUTH_SOCK環境變量。

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

  • 無法連接節點,請檢查配置的地址address和端口port是否有誤。

啟動集群報錯

Failed to get job complete status 無法獲取”job complete“狀態

觸發這個報錯信息的最常見原因是節點內有些問題,阻止了節點內的 job 成功運行。請運行下文的命令,檢查節點狀態,排查問題。

運行以下命令以列出節點 Conditions,關於節點 Conditions 請查看節點 Conditions

kubectl get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{$node.metadata.name}}{{": "}}{{.type}}{{":"}}{{.status}}{{"\n"}}{{end}}{{end}}'

運行以下命令以列出節點有問題的 Conditions,關於節點 Conditions 請查看節點 Conditions

kubectl get nodes -o go-template='{{range .items}}{{$node := .}}{{range .status.conditions}}{{if ne .type "Ready"}}{{if eq .status "True"}}{{$node.metadata.name}}{{": "}}{{.type}}{{":"}}{{.status}}{{"\n"}}{{end}}{{else}}{{if ne .status "True"}}{{$node.metadata.name}}{{": "}}{{.type}}{{": "}}{{.status}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'

輸出示例:

worker-0: DiskPressure:True

您也可以運行以下命令,查看日志中是否有關於 job 報錯的信息,請將命令中的日志名稱rke-network-plugin-deploy-job替換為您的日志名稱。

kubectl -n kube-system get pods -l job-name=rke-network-plugin-deploy-job --no-headers -o custom-columns=NAME:.metadata.name | xargs -L1 kubectl -n kube-system logs

Failed to apply the ServiceAccount needed for job execution

因為這個操作需要將運行了rke up命令的主機和 controplane 節點連接,這個問題在多數情況下是由於主機代理配置信息有誤而造成的。出現這個錯誤之后返回的信息是由阻止這個請求的代理發出的。請檢查HTTP_PROXY、HTTPS_PROXY和NO_PROXY這三個環境變量是否配置正確。如果主機通過配置的代理無法訪問 controlplane 節點,請重點檢查NO_PROXY(要在NO_PROXY中添加這個 IP 區間)。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM