Downgrading Kubectl with Homebrew
I started seeing the following error when attempting to list pods with
kubectl get pods -n production:
No resources found.
Error from server (NotAcceptable): unknown (get pods)
A quick search led me to a GitHub issue which explained that my version of
kubectl was incompatible with the server.
The fix is to revert to an older version but I installed
kubectl via Homebrew which only maintains a single version. What I didn’t know is that it’s possible to install a Homebrew package from a URL which makes downgrading easy.
First uninstall the newest version:
brew uninstall kubernetes-cli
Find a compatible version from the history of changes to the kubernetes-cli formula and install:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d09d97241b17a5e02a25fc51fc56e2a5de74501c/Formula/kubernetes-cli.rb
Now everything works again. You should probably pin the newly-installed old version so that it won’t get upgraded the next time you run
brew pin kubernetes-cli
Originally published at www.benpickles.com