Skip to content

Unregister gitlab runner on Kubernetes

Hello,

I am having trouble with Kuberenetes pods running gitlab-runner. Latest and previous versions. Additionally, my runners don't get unregistered automatically, so I tried to investigate. Although, I provided unregisterRunner option to true it doesn't get suppress from the list.

At this time, I run the command manually before updating my configuration and kill the pod.

Additionally, I noticed that trying to unregister without providing credential results in a segfault. I doubt this is expected behavior.

root@gitlab-runner-deployment-7475c6c5cf-jvfjk:/# gitlab-runner unregister
Runtime platform                                    arch=arm64 os=linux pid=63 revision=9882d9c7 version=17.2.1
Running in system-mode.                            
                                                   
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xee5958]

goroutine 1 [running]:
main.main.func1()
	/builds/gitlab-org/gitlab-runner/main.go:52 +0x60
panic({0x1bec7a0?, 0x378f150?})
	/usr/local/go/src/runtime/panic.go:770 +0x124
gitlab.com/gitlab-org/gitlab-runner/commands.(*UnregisterCommand).unregisterSingleRunner(0x40006242d0)
	/builds/gitlab-org/gitlab-runner/commands/unregister.go:45 +0xc8
gitlab.com/gitlab-org/gitlab-runner/commands.(*UnregisterCommand).Execute(0x40006242d0, 0x36e688?)
	/builds/gitlab-org/gitlab-runner/commands/unregister.go:82 +0x88
github.com/urfave/cli.HandleAction({0x1a9b1c0?, 0x4000eb8630?}, 0xa?)
	/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:526 +0x94
github.com/urfave/cli.Command.Run({{0x1fed2dc, 0xa}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x201558c, 0x1a}, {0x0, ...}, ...}, ...)
	/go/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:175 +0x534
github.com/urfave/cli.(*App).Run(0x4000603500, {0x400004c0c0, 0x2, 0x2})
	/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:277 +0x7f8
main.main()
	/builds/gitlab-org/gitlab-runner/main.go:82 +0x63c

However, providing kubectl execution command with correct credential works but i have to do it manually for every pod.