#SharePointProblems | Koskila.net

Solutions are worthless unless shared! Antti K. Koskela's Personal Professional Blog
>

Any kubectl command throws "Unhandled Error" err="couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused" - what do?

koskila
Reading Time 3 min
Word Count 486 words
Comments 0 comments
Rating n/a (0 votes)
View

This article explains a fix to a - frankly possibly a little bit dumb - problem, where all kubectl commands suddenly throw an error along the lines of "couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused".

Since I don't ever have Kubernetes running locally, and I actually don't even change kubectl connections, I was quite confused by this.

But read on to find out how I resolved my dumb mistake!

Problem

You could be running any kubectl command to query any data from the service - even this:

kubectl cluster-info

But you get this:

E0527 09:44:02.891142   59546 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"E0527 09:44:02.892976   59546 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"E0527 09:44:02.894616   59546 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"E0527 09:44:02.896234   59546 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"E0527 09:44:02.898040   59546 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"

What do?

Reason

I recently switched over to a new daily driver at work - my first mac - and while I've had to become pretty good at backing up, migrating and restoring my stuff (including configuration) on Windows (since it kept crashing and burning all the time), I have little experience setting things up on a mac.

But set things up I did, and soon I had all of my usual tools set up to run in -zsh, in iTerm2. But the first time I was running a good old "kubectl logs podname | Set-Content /Users/koskila/mystuff/logs/250527-94226.log", I realized none of my usual PowerShell goodness works in -zsh.

Go figure, right?

So I switched over to PowerShell. Because I had it installed. And suddenly kubectl couldn't connect.

...

Can you see the problem already?

Solution

Now, I know this might be a bit stupid. There's a good chance you're smarter than me, so your issue might also be more advanced than mine.

But if you're exactly as smart as I am, and your problem is the same as mine, here's what to do:

  1. Make sure you've run
az account set --subscription <your-guid-here>
az aks get-credentials --resource-group <rg-name-here> --name <AKS-cluster-name> --overwrite-existing

I had, of course, ran them. But not in the right console window, and the context isn't shared.

I don't know why and how I have literally never - not even once - made this mistake on my Windows machine, but ran into it on a mac. Maybe I just didn't have my $KUBECONFIG set up in PowerShell, but running the az cli commands fixed it...?

Perhaps I'll never know - but at least it's working now!

Hope it helps you as well 😅

Comments

Interactive comments not implemented yet. Showing legacy comments migrated from WordPress.

No comments yet.