alexellis/k3sup

k3sup join needs two --ssh-key, one for server and another one for joining server

aminnasiri opened this issue · 3 comments

I was able to create a K8s cluster and would like to add more master to this cluster. I have 2 different set of ssh private and public keys one set for first master which create K8s cluster and second set for the new server. I ran this command, and getting this error

k3sup join \
  --ip <new-server-ip> \
  --user <new-server-user> \
  --sudo \
  --server-user <master-server-user> \
  --server-ip <master-server-ip> \
  --ssh-key ~/.ssh/oracle/{the_new_server_private_key_name}.key \
  --server 

The error

Error: unable to connect to<new-server-ip> over ssh as opc: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Why do you need this?

I would like to add more servers and nodes to my cluster

Expected Behaviour

I am expecting to have 2 parameter of ssh key to be able set them primer master and a new servers

Current Behaviour

Throwing an error

Running: k3sup join
Server IP:<master-server-ip>
K10f81e9d64557b56f1f8b336e5f1bf14a5cb5805d3129b1015f6f62268ff854598::server:a35ef7e1413886e854a2798d99252eca
Error: unable to connect to<new-server-ip> over ssh as opc: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Possible Solution

Don't have any idea.

Steps to Reproduce

  1. Create a cluster with this command on server one
k3sup install \
  --ip=<master-server-ip> \
  --user <master-server-user> \
  --sudo \
  --cluster \
  --k3s-channel=stable \
  --merge \
  --local-path $HOME/.kube/config \
  --context=oracle \
  --ssh-key ~/.ssh/oracle/{the_master_server_private_key_name}.key
  1. Run kubectl
 kubectl get node -o wide
NAME                STATUS   ROLES                       AGE   VERSION        INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                  KERNEL-VERSION                   CONTAINER-RUNTIME
instance-worker-3   Ready    control-plane,etcd,master   10h   v1.26.3+k3s1   10.0.0.118    <none>        Oracle Linux Server 9.1   5.15.0-6.80.3.1.el9uek.aarch64   containerd://1.6.19-k3s1
  1. Run k3sup join command
k3sup join \
  --ip <new-server-ip> \
  --user <new-server-user> \
  --sudo \
  --server-user <master-server-user> \
  --server-ip <master-server-ip> \
  --ssh-key ~/.ssh/oracle/{the_new_server_private_key_name}.key \
  --server 
  1. See the error

Your Environment

  • k3sup version:
k3sup version

Version: 0.12.12
Git Commit: 02c7a77

  • What Kubernetes distribution, client and server version are you using?
kubectl version

Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.25.4
Kustomize Version: v4.5.7
Server Version: v1.26.3+k3s1

  • What OS or type or VM are you using for your cluster? Where is it hosted? (for k3sup install/join):

  • Operating System and version (e.g. Linux, Windows, MacOS):

uname -a

cat /etc/os-release

Darwin 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64

Do you want to work on this?

Subject to design approval, are you willing to work on a Pull Request for this issue or feature request?

  • Yes
  • [X ] No

Hi @aminnasiri

We haven't needed this in three and a half years, so I think it's safe to say that we don't need it now.

In fact, there is a very simple fix here, which is for you to run ssh-copy-id user@server.

Regards,

Alex

/add label: support, question,wontfix

I tried these commands before creating this ticket and got an error too.
Steps:
ssh-copy-id -i ~/.ssh/<master-public.key>.pub opc@<master-server-ip>

k3sup join \
  --ip 129.146.72.24 \
  --user <new-server-user> \
  --sudo \
  --server-user <master-server-user> \
  --server-ip <master-server-ip> \
  --ssh-key ~/.ssh/<new-server-private.key>.key \
  --server 

The error

Error: unable to connect to<master-server-ip> over ssh as  <master-server-user>: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

I don't know how you have been handling this situation, but there are lots of tickets on it in different ways of explanations on this git-repo.