Knative Error: invalid apiVersion “client.authentication.k8s.io/v1alpha1

Error

$ func deploy
   🙌 Function image built: docker.io/rajeshkumarin/hello:latest
Please provide credentials for image registry (index.docker.io).
? Username: rajeshkumarin
? Password: ************
Credentials will not be saved.
If you would like to save your credentials in the future,
you can install docker credential helper https://github.com/docker/docker-credential-helpers.
   ⬆️  Deploying function to the cluster
Error: failed to create new serving client: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

$ kn service create hello \
> --image gcr.io/knative-samples/helloworld-go \
> --port 8080 \
> --env TARGET=World
Error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
Run 'kn --help' for usage

$ kubectl version
Kubeconfig user entry is using deprecated API version client.authentication.k8s.io/v1alpha1. Run 'aws eks update-kubeconfig' to update.
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-15T21:38:50Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.16-eks-ffeb93d", GitCommit:"52e500d139bdef42fbc4540c357f0565c7867a81", GitTreeState:"clean", BuildDate:"2022-11-29T18:41:42Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}

Solution – 1

$ aws eks update-kubeconfig --name ${EKS_CLUSTER_NAME} --region ${REGION}
$ aws eks update-kubeconfig --name myeks --region us-west-2

Solution – 2

Modify .kube/config file

Change v1alpha1 to v1beta1:

<             apiVersion: client.authentication.k8s.io/v1beta1

>             apiVersion: client.authentication.k8s.io/v1alpha1