Skip to content

invalid memory address or nil pointer dereference with kubernetes v1.27.0 #2055

@SammyA

Description

@SammyA




Describe the bug
On a cluster i just upgraded to v1.27.0 k9s crashes at startup with the following message:

Boom!! runtime error: invalid memory address or nil pointer dereference.

This does not happen on all v1.27.0 clusters. For example: a clean installed new v1.27.0 cluster works fine. I'm suspecting k9s chokes on some installed custom resource.

I tried building k9s from source, and with k8s.io/client-go@v0.27.0 it seems to work OK.

To Reproduce

  1. Get a nicely worn in cluster, with lots of custom resources, upgraded to v1.27.0
  2. Connect with k9s
  3. Boom!!

Expected behavior
no Boom!!

Versions (please complete the following information):

  • OS: Debian/GNU Linux Bullseye
  • K9s: v0.27.3
  • K8s: v1.27.0

Additional context
Stack trace from the log:

3:31PM INF 🐶 K9s starting up...
3:31PM ERR Boom! runtime error: invalid memory address or nil pointer dereference
3:31PM ERR goroutine 1 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/derailed/k9s/cmd.run.func2()
        github.com/derailed/k9s/cmd/root.go:72 +0xb1
panic({0x2147140, 0x3bf32c0})
        runtime/panic.go:884 +0x212
k8s.io/client-go/discovery.convertAPIResource(...)
        k8s.io/client-go@v0.26.1/discovery/aggregated_discovery.go:88
k8s.io/client-go/discovery.convertAPIGroup({{{0x0, 0x0}, {0x0, 0x0}}, {{0xc00049df38, 0x15}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...})
        k8s.io/client-go@v0.26.1/discovery/aggregated_discovery.go:69 +0x5f0
k8s.io/client-go/discovery.SplitGroupsAndResources({{{0xc00049c540, 0x15}, {0xc000b84800, 0x1b}}, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...})
        k8s.io/client-go@v0.26.1/discovery/aggregated_discovery.go:35 +0x2f8
k8s.io/client-go/discovery.(*DiscoveryClient).downloadAPIs(0xc000c3e1e0?)
        k8s.io/client-go@v0.26.1/discovery/discovery_client.go:310 +0x47c
k8s.io/client-go/discovery.(*DiscoveryClient).GroupsAndMaybeResources(0x0?)
        k8s.io/client-go@v0.26.1/discovery/discovery_client.go:198 +0x5c
k8s.io/client-go/discovery/cached/memory.(*memCacheClient).refreshLocked(0xc000400ae0)
        k8s.io/client-go@v0.26.1/discovery/cached/memory/memcache.go:222 +0x57
k8s.io/client-go/discovery/cached/memory.(*memCacheClient).GroupsAndMaybeResources(0xc000400ae0)
        k8s.io/client-go@v0.26.1/discovery/cached/memory/memcache.go:128 +0xc5
k8s.io/client-go/discovery/cached/memory.(*memCacheClient).ServerGroups(0xc0003a96d0?)
        k8s.io/client-go@v0.26.1/discovery/cached/memory/memcache.go:148 +0x19
k8s.io/client-go/discovery/cached/disk.(*CachedDiscoveryClient).ServerGroups(0xc0003a96d0)
        k8s.io/client-go@v0.26.1/discovery/cached/disk/cached_discovery.go:118 +0x172
github.com/derailed/k9s/internal/client.(*APIClient).supportsMetricsResources(0xc0001ce690)
        github.com/derailed/k9s/internal/client/client.go:454 +0x16f
github.com/derailed/k9s/internal/client.InitConnection(0xc000164700)
        github.com/derailed/k9s/internal/client/client.go:64 +0x135
github.com/derailed/k9s/cmd.loadConfiguration()
        github.com/derailed/k9s/cmd/root.go:122 +0x5e7
github.com/derailed/k9s/cmd.run(0x3c0b080?, {0x2478bfb?, 0x7?, 0x7?})
        github.com/derailed/k9s/cmd/root.go:82 +0x2e6
github.com/spf13/cobra.(*Command).execute(0x3c0b080, {0xc0001b6010, 0x7, 0x7})
        github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x3c0b080)
        github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.6.1/command.go:968
github.com/derailed/k9s/cmd.Execute()
        github.com/derailed/k9s/cmd/root.go:50 +0x25
main.main()
        github.com/derailed/k9s/main.go:29 +0x17

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions