kubectx: [Go] kubens error with Azure auth provider: invalid memory address or nil pointer dereference

When I try to use kubens it just prints an error:

C:\>kubens
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x1115a97]

goroutine 1 [running]:
k8s.io/client-go/plugin/pkg/client/auth/azure.(*azureTokenSource).storeTokenInCfg(0xc00023bdc0, 0xc000592000, 0xd, 0xc000592000)
        /home/runner/go/pkg/mod/k8s.io/client-go@v0.17.0/plugin/pkg/client/auth/azure/azure.go:276 +0x397
k8s.io/client-go/plugin/pkg/client/auth/azure.(*azureTokenSource).Token(0xc00023bdc0, 0x0, 0x0, 0x0)
        /home/runner/go/pkg/mod/k8s.io/client-go@v0.17.0/plugin/pkg/client/auth/azure/azure.go:206 +0x2b3
k8s.io/client-go/plugin/pkg/client/auth/azure.(*azureRoundTripper).RoundTrip(0xc0003533c0, 0xc0001e0600, 0x13e131d, 0xa, 0xc000375d80)
        /home/runner/go/pkg/mod/k8s.io/client-go@v0.17.0/plugin/pkg/client/auth/azure/azure.go:125 +0x88
k8s.io/client-go/transport.(*userAgentRoundTripper).RoundTrip(0xc0003533e0, 0xc0001e0500, 0xc0003533e0, 0x0, 0x0)
        /home/runner/go/pkg/mod/k8s.io/client-go@v0.17.0/transport/round_trippers.go:159 +0x1c7
net/http.send(0xc0001e0500, 0x1584520, 0xc0003533e0, 0x0, 0x0, 0x0, 0xc0000cadd8, 0x2030000, 0x1, 0x0)
        /opt/hostedtoolcache/go/1.14.2/x64/src/net/http/client.go:252 +0x445
net/http.(*Client).send(0xc00033f3e0, 0xc0001e0500, 0x0, 0x0, 0x0, 0xc0000cadd8, 0x0, 0x1, 0xc000375a20)
        /opt/hostedtoolcache/go/1.14.2/x64/src/net/http/client.go:176 +0x101
net/http.(*Client).do(0xc00033f3e0, 0xc0001e0500, 0x0, 0x0, 0x0)
        /opt/hostedtoolcache/go/1.14.2/x64/src/net/http/client.go:699 +0x451
net/http.(*Client).Do(...)
        /opt/hostedtoolcache/go/1.14.2/x64/src/net/http/client.go:567
k8s.io/client-go/rest.(*Request).request(0xc00026e960, 0xc0000c7830, 0x0, 0x0)
        /home/runner/go/pkg/mod/k8s.io/client-go@v0.17.0/rest/request.go:801 +0x3f0
k8s.io/client-go/rest.(*Request).Do(0xc00026e960, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/k8s.io/client-go@v0.17.0/rest/request.go:873 +0xdf
k8s.io/client-go/kubernetes/typed/core/v1.(*namespaces).List(0xc00036ab50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/k8s.io/client-go@v0.17.0/kubernetes/typed/core/v1/namespace.go:86 +0x17e
main.queryNamespaces(0xc0000c7e68, 0xc000281408, 0x7, 0xc000281188, 0x7, 0x0)
        /home/runner/work/kubectx/kubectx/cmd/kubens/list.go:73 +0x2b7
main.ListOp.Run(0x1584900, 0xc0000ca008, 0x1584900, 0xc0000ca010, 0x0, 0x0)
        /home/runner/work/kubectx/kubectx/cmd/kubens/list.go:37 +0x209
main.main()
        /home/runner/work/kubectx/kubectx/cmd/kubens/main.go:20 +0x10f

kubectl and kubectx work. they all are located in the same folder that is also added to the path.

using newest versions of kubectl kubectx and kubens. OS: Windows 10 1809

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 23 (15 by maintainers)

Most upvoted comments

@ahmetb I guess you are right, #260 is hack if go-client API is allowing to create client in read-only mode no auth plugin should fail eventually. I’ve created a PR to address this issue in go-client https://github.com/kubernetes/kubernetes/pull/97095 let’s see how it goes