k3d
k3d copied to clipboard
[BUG] Nil pointer dereference in patchServerSpec
What did you do
-
How was the cluster created?
- An external k3s cluster was created using an etcd database.
-
What did you do afterwards?
-
k3d node create newnode -t <TOKEN> -c <URL> --role server --trace --verbose
-
What did you expect to happen
New node successfully created and joined to the cluster.
Screenshots or terminal output
[neil@QNAP bin]$ k3d node create qnap-k3s -t <TOKEN> -c https://<HOST>.lan:6443 --role server --trace --verbose
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock
DEBU[0000] Runtime Info:
&{Name:docker Endpoint:/var/run/docker.sock Version:20.10.17-qnap1 OSType:linux OS:QTS 5.0.0 (20220614) Arch:x86_64 CgroupVersion:1 CgroupDriver:cgroupfs Filesystem:UNKNOWN}
INFO[0000] Adding 1 node(s) to the remote cluster 'https://<HOST>.lan:6443'...
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock
TRAC[0000] Creating node from spec
&{Name:k3d-qnap-k3s-0 Role:server Image:docker.io/rancher/k3s:v1.24.4-k3s1 Volumes:[] Env:[K3S_URL=https://<HOST>.lan:6443 K3S_TOKEN=<TOKEN>] Cmd:[] Args:[] Ports:map[] Restart:true Created: HostPidMode:false RuntimeLabels:map[app:k3d k3d.cluster:https://<HOST>.lan:6443 k3d.cluster.external:true k3d.cluster.token:<TOKEN> k3d.cluster.url:https://<HOST>.lan:6443 k3d.role:server k3d.version:v5.4.6] K3sNodeLabels:map[] Networks:[] ExtraHosts:[] ServerOpts:{IsInit:false KubeAPI:<nil>} AgentOpts:{} GPURequest: Memory: State:{Running:false Status: Started:} IP:{IP:zero IP Static:false} HookActions:[]}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xbca7f6]
goroutine 10 [running]:
github.com/k3d-io/k3d/v5/pkg/client.patchServerSpec(...)
/home/runner/work/k3d/k3d/pkg/client/node.go:681
github.com/k3d-io/k3d/v5/pkg/client.NodeCreate({0xf49520, 0xc0007466c0}, {0xf57d68, 0x1528898}, 0xc000187380, {0x1, 0x0, {0x0, 0x0, 0x0}, ...})
/home/runner/work/k3d/k3d/pkg/client/node.go:579 +0x7f6
github.com/k3d-io/k3d/v5/pkg/client.NodeRun({0xf49520, 0xc0007466c0}, {0xf57d68, 0x1528898}, 0xc000187380, {0x1, 0x0, {0x0, 0x0, 0x0}, ...})
/home/runner/work/k3d/k3d/pkg/client/node.go:383 +0x86
github.com/k3d-io/k3d/v5/pkg/client.NodeAddToClusterRemote({0xf49520, 0xc0007466c0}, {0xf57d68, 0x1528898}, 0xc000187380, {0x7ffd19bc0b01, 0x18}, {0x1, 0x0, {0x0, ...}, ...})
/home/runner/work/k3d/k3d/pkg/client/node.go:297 +0x93d
github.com/k3d-io/k3d/v5/pkg/client.NodeAddToClusterMultiRemote.func1()
/home/runner/work/k3d/k3d/pkg/client/node.go:337 +0x5b
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:74 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:71 +0xa5
Which OS & Architecture
This is running on a QNAP NAS with a custom docker build, but I don't think that would make a difference here as the crash is before even running any docker commands.
arch: x86_64
cgroupdriver: cgroupfs
cgroupversion: "1"
endpoint: /var/run/docker.sock
filesystem: UNKNOWN
name: docker
os: QTS 5.0.0 (20220614)
ostype: linux
version: 20.10.17-qnap1
Which version of k3d
k3d version v5.4.6
k3s version v1.24.4-k3s1 (default)
Which version of docker
Client:
Version: 20.10.17-qnap1
API version: 1.41
Go version: go1.17.11
Git commit: 0474f29
Built: Tue Jun 14 10:41:04 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17-qnap1
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: 571a584
Built: Tue Jun 14 03:04:25 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309f
docker-init:
Version: 0.19.0
GitCommit: de40ad0
I think maybe this setup is not supported (creating a new node and joining to an external cluster) but it's not clear from the documentation.
I've realised that it works if I change the role to agent
. Is the server
role not supported with external clusters?