cnrancher / autok3s

Run K3s Everywhere
https://www.suse.com
Apache License 2.0
753 stars 76 forks source link

[BUG] k3d provider can't join more than one worker node to a cluster with only a master node #615

Closed sunyakun closed 1 year ago

sunyakun commented 1 year ago

Describe the bug

k3d 集群初次创建时如果只有一个 master 节点,那么使用 autok3s join 命令则最多只能添加一个 worker 节点,当超过一个 worker 节点后再次执行 autok3s join 则会失败

To reproduce

  1. 使用 autok3s 创建一个只有一个 master 节点的 k3d 集群

    $ autok3s create -p k3d --name test --master 1
  2. 向 k3d 集群添加一个 worker 节点

    $ autok3s join -p k3d --name test --worker 1
  3. 继续向集群添加 worker 节点

    $ autok3s join -p k3d --name test --worker 1

Expected behavior

期望命令全部执行成功,最终 k3d 集群有一个 master 节点和两个 worker 节点

Screenshots

image

Environments (please complete the following information):

JacieChao commented 1 year ago

Thanks for the feedback. When adding the agent node one by one, the K3d agent name is duplicated when stitching the K3d Node name.

As a workaround, please add or join multiple worker nodes at one time. We will fix this issue in the next version.

sunyakun commented 1 year ago

By the way, if the join command fails to execute, autok3s will attempt to perform a rollback, including deleting the kubectl context config. I believe this behavior is unexpected.

JacieChao commented 1 year ago

Yes, rollback with failure won't remove the kubectl context config when joining nodes. Will fix this issue too.

sunyakun commented 1 year ago

I would be happy to submit a PR to fix this bug. You can assign this issue to me.

JacieChao commented 1 year ago

Sure. Thanks