我已经在客户端生成了ssh-key,并将它们复制到主节点和工作节点。路径是~/.ssh/id_rsa。我遇到了这个错误,使用sudo -S也不能修复它。
k3sup join --ip $WORKER_IP --user $WORKER_USER --server-ip $MASTER_IP --server-user $MASTER_USER --k3s-extra-args "--node-external-ip $WORKER_IP --node-ip $WORKER_IP" --k3s-channel stable --print-command
Running: k3sup join
ssh: sudo cat /var/lib/rancher/k3s/server/node-token
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
Error: unable to get join-token from server: Process exited with status 1
但是,我希望得到以下输出:
$ k3sup join --ip $WORKER_IP --user $WORKER_USER --server-ip $MASTER_IP --server-user $MASTER_USER --k3s-extra-args "--node-external-ip $WORKER_IP --node-ip $WORKER_IP" --k3s-channel stable --print-command
Running: k3sup join
ssh: sudo cat /var/lib/rancher/k3s/server/node-token
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx::server:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ssh: curl -sfL https://get.k3s.io | K3S_URL='https://10.1.1.1:6443' K3S_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx::server:xxxxxxxxxxxxxxxxxxxxxxxxx' INSTALL_K3S_CHANNEL='stable' sh -s - --node-external-ip 10.1.1.2 --node-ip 10.1.1.2
\[INFO\] Finding release for channel stable
\[INFO\] Using v1.20.0+k3s2 as release
\[INFO\] Downloading hash https://github.com/rancher/k3s/releases/download/v1.20.0+k3s2/sha256sum-amd64.txt
\[INFO\] Downloading binary https://github.com/rancher/k3s/releases/download/v1.20.0+k3s2/k3s
\[INFO\] Verifying binary download
\[INFO\] Installing k3s to /usr/local/bin/k3s
\[INFO\] Creating /usr/local/bin/kubectl symlink to k3s
\[INFO\] Creating /usr/local/bin/crictl symlink to k3s
\[INFO\] Creating /usr/local/bin/ctr symlink to k3s
\[INFO\] Creating killall script /usr/local/bin/k3s-killall.sh
\[INFO\] Creating uninstall script /usr/local/bin/k3s-agent-uninstall.sh
\[INFO\] env: Creating environment file /etc/systemd/system/k3s-agent.service.env
\[INFO\] systemd: Creating service file /etc/systemd/system/k3s-agent.service
\[INFO\] systemd: Enabling k3s-agent unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
\[INFO\] systemd: Starting k3s-agent
Logs: Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
Output: \[INFO\] Finding release for channel stable
\[INFO\] Using v1.20.0+k3s2 as release
\[INFO\] Downloading hash https://github.com/rancher/k3s/releases/download/v1.20.0+k3s2/sha256sum-amd64.txt
\[INFO\] Downloading binary https://github.com/rancher/k3s/releases/download/v1.20.0+k3s2/k3s
\[INFO\] Verifying binary download
\[INFO\] Installing k3s to /usr/local/bin/k3s
\[INFO\] Creating /usr/local/bin/kubectl symlink to k3s
\[INFO\] Creating /usr/local/bin/crictl symlink to k3s
\[INFO\] Creating /usr/local/bin/ctr symlink to k3s
\[INFO\] Creating killall script /usr/local/bin/k3s-killall.sh
\[INFO\] Creating uninstall script /usr/local/bin/k3s-agent-uninstall.sh
\[INFO\] env: Creating environment file /etc/systemd/system/k3s-agent.service.env
\[INFO\] systemd: Creating service file /etc/systemd/system/k3s-agent.service
\[INFO\] systemd: Enabling k3s-agent unit
\[INFO\] systemd: Starting k3s-agent
1条答案
按热度按时间taor4pac1#
你在你的工作节点上缺少允许运行sudo而无需重复密码的配置。在工作节点上执行sudo visudo,然后添加以下worker-username ALL=(ALL)NOPASSWD:所有保存和退出更多信息可在这里:https://github.com/alexellis/k3sup#pre-requisites-for-k3sup-servers-and-agents