Closed sootma closed 2 years ago
@sootma Thanks for the issue! The log shows that AutoK3s can't access your host through ssh. Could you try to ssh to your host by ssh configuration that config with AutoK3s to see if it can work fine?
i'm sure ssh is ok. first , I exec the autok3s by ssh to vm, but get the error, then I directly exec the command in vm with root, but get same error. and debian10, debian11 both get the same error.
@sootma The logs show AutoK3s can't ssh to VM with your ssh configuration. I tried using AutoK3s to deploy native cluster on debian10 VM. It works fine with the following command.
autok3s create --provider native --name jacie-test --ssh-key-path ~/.ssh/id_rsa --ssh-port 22 --ssh-user admin --master-ips x.x.x.x
The --ssh-user
, --ssh-password
or --ssh-key-path
params is the same as your ssh command?
I use ssh-user & ssh-password
I use root user to create k3s by autok3s, but root can't connect ssh with autok3s in debian10, so get the error.
I run autok3s with user & pwd,
autok3s create \
--provider native \
--name k3s2 \
--k3s-install-mirror INSTALL_K3S_MIRROR=cn \
--k3s-install-script http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh \
--ssh-user xl \
--ssh-password 111111 \
--master-ips 192.168.162.135
first get "sudo: no tty present and no askpass program specified" . then I modify /etc/sudoers by visudo, add :
Defaults visiblepw
xl ALL = NOPASSWD: ALL
xl ALL=(ALL) NOPASSWD: ALL
, then create again, I get the message: no password was provided
below is all message: xl@debian:~$ autok3s create --provider native --name k3s6 --k3s-install-mirror INSTALL_K3S_MIRROR=cn --k3s-install-script http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh --ssh-password 111111 --ssh-user xl --master-ips 192.168.162.135 time="2022-05-11T18:43:13+08:00" level=info msg="[native] begin to create cluster k3s6..." time="2022-05-11T18:43:13+08:00" level=info msg="[native] executing init k3s cluster logic..." time="2022-05-11T18:43:13+08:00" level=info msg="[native] creating k3s master-1..." time="2022-05-11T18:43:13+08:00" level=info msg="[cluster] k3s master command: curl -sLS http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN='9263de45565700b12d331854629aee43' INSTALL_K3S_EXEC='server --tls-san 192.168.162.135 --node-external-ip 192.168.162.135 --cluster-cidr 10.42.0.0/16' INSTALL_K3S_CHANNEL='stable' sh -" [sudo] password for xl: sudo: no password was provided [INFO] Finding release for channel stable [INFO] Using v1.23.6+k3s1 as release [INFO] Downloading hash https://rancher-mirror.rancher.cn/k3s/v1.23.6-k3s1/sha256sum-amd64.txt [INFO] Downloading binary https://rancher-mirror.rancher.cn/k3s/v1.23.6-k3s1/k3s [INFO] Verifying binary download [INFO] Installing k3s to /usr/local/bin/k3s [sudo] password for xl: sudo: no password was provided time="2022-05-11T18:43:35+08:00" level=error msg="Process exited with status 1: [sudo] password for xl: \nsudo: no password was provided\n[sudo] password for xl: \nsudo: no password was provided\n" time="2022-05-11T18:43:35+08:00" level=info msg="[native] executing rollback logic..." time="2022-05-11T18:43:35+08:00" level=info msg="[native] instances [192-168-162-135] will be rollback" sh: 0: Can't open /usr/local/bin/k3s-uninstall.sh time="2022-05-11T18:43:35+08:00" level=warning msg="[native] failed to uninstall k3s on master node 192-168-162-135: Process exited with status 127: sh: 0: Can't open /usr/local/bin/k3s-uninstall.sh\n" time="2022-05-11T18:43:35+08:00" level=info msg="[native] successfully executed rollback logic" FATA[0023] Process exited with status 1: [sudo] password for xl: sudo: no password was provided [sudo] password for xl: sudo: no password was provided
@sootma Is it possible to execute sudo
command without password if ssh login with your xl
user to the VM?
I tried with your steps but it works fine for me.
sudo useradd -m jacie
sudo passwd jacie
$ sudo -i
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for jacie:
3. Set sudo nopassword with visudo and add following line
jacie ALL=(ALL) NOPASSWD:ALL
4. Check result: Try to SSH to VM with user jacie again and user can running without sudo password.
5. Using AutoK3s to start a cluster with user jacie. The K3s cluster installed successfully.
autok3s create --provider native --name jacie-test --ssh-password xxxx --ssh-port 22 --ssh-user jacie --master-ips 192.168.64.3
thank you very much! must replace "xl ALL=(ALL) NOPASSWD: ALL" to the end. now I haved installed successed!
time="2022-05-08T13:37:10+08:00" level=info msg="[native] creating k3s master-1..." time="2022-05-08T13:37:10+08:00" level=info msg="[cluster] k3s master command: curl -sLS http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN='59336ed8ffca8dbf76c37f2becbf99ae' INSTALL_K3S_EXEC='server --tls-san 192.168.162.135 --node-external-ip 192.168.162.135 --cluster-cidr 10.42.0.0/16' INSTALL_K3S_CHANNEL='stable' sh -" time="2022-05-08T13:39:21+08:00" level=error msg="[ssh-dialer] init dialer [192.168.162.135:22] error: timed out waiting for the condition" time="2022-05-08T13:39:21+08:00" level=info msg="[native] executing rollback logic..." time="2022-05-08T13:39:21+08:00" level=info msg="[native] instances [192-168-162-135] will be rollback" time="2022-05-08T13:41:34+08:00" level=warning msg="[native] failed to uninstall k3s on master node 192-168-162-135: [ssh-dialer] init dialer [192.168.162.135:22] error: timed out waiting for the condition" W0508 13:41:34.725142 712 loader.go:221] Config not found: /home/xl/.autok3s/.kube/config time="2022-05-08T13:41:34+08:00" level=info msg="[native] successfully executed rollback logic" FATA[0266] [ssh-dialer] init dialer [192.168.162.135:22] error: timed out waiting for the condition