k3s: [release-1.21] Panic checking name of uninitialized etcd member

Environmental Info: K3s Version: k3s version v1.21.7+k3s1 (ac705709) go version go1.16.10

Node(s) CPU architecture, OS, and Version: Raspberry Pi Linux k8smaster1 5.10.83-1-MANJARO-ARM-RPI #1 SMP PREEMPT Tue Dec 7 08:43:25 CST 2021 aarch64 GNU/Linux (They all have the same image, but with different static IPs and hostnames: k8smaster0, k8smaster1, k8sworker0, k8sworker1.

Cluster Configuration: 1 server, 2 agents The server had --cluster-init passed to it, and it has etcd.

Describe the bug: I attempted to add a second master and got a strange error. The first master was given --cluster-init, so etcd was in its roles. Here’s the end of the log if I try to start it manually on the command line with k3s server:

INFO[2021-12-17T19:52:17.353594206-05:00] Containerd is now running                    
INFO[2021-12-17T19:52:17.384384680-05:00] Connecting to proxy                           url="wss://127.0.0.1:6443/v1-k3s/connect"
ERRO[2021-12-17T19:52:17.394193344-05:00] Failed to connect to proxy                    error="websocket: bad handshake"
ERRO[2021-12-17T19:52:17.394287287-05:00] Remotedialer proxy error                      error="websocket: bad handshake"
panic: runtime error: slice bounds out of range [:-1]

goroutine 232 [running]:
github.com/rancher/k3s/pkg/etcd.(*ETCD).join(0x4000e2f770, 0x4b02318, 0x4001151c80, 0x4001342000, 0x0, 0x0)
	/go/src/github.com/rancher/k3s/pkg/etcd/etcd.go:350 +0xfd8
github.com/rancher/k3s/pkg/etcd.(*ETCD).Start.func1(0x4000e2f770, 0x4b02318, 0x4001151c80, 0x4001342000)
	/go/src/github.com/rancher/k3s/pkg/etcd/etcd.go:307 +0x58
created by github.com/rancher/k3s/pkg/etcd.(*ETCD).Start
	/go/src/github.com/rancher/k3s/pkg/etcd/etcd.go:305 +0xe0

It may be worth noting that I was able to join 2 worker nodes without a problem.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

I’m going to reopen this so that we can fix the panic.

You probably need to configure that same static address in your netplan or whatever Manjaro is using.