How to fix kubectl exec plugin invalid apiVersion client.authentication.k8s.io/v1alpha1 into MacOS

are you getting this error after updating kubectl?

if you are at version 1.24, so you could downgrade or try to use asdf.

brew install asdf
asdf plugin-add kubectl
asdf install kubectl 1.23.7
asdf shell kubectl 1.23.7

So the command:

kubectl version --client=true --short=true

Should display:

Client Version: v1.23.7

--

--