I have this very well documented issue that others seem to have as well. I am using a GKE cluster and I used to be able to deploy images with any issue using kubectl apply, but earlier this year this started happening. Also, others in my team have no issue using the exact same commands. Furthermore, what's really disturbing is that if I try the exact same command multiple times (5-6) every 6th, 7th time it seems to work. Sometimes it doesn't work for hours.
Problem: I get error message "Unable to connect to the server: x509: certificate signed by unknown authority".
When it happens: When I run any kubectl command. It doesn't have to be apply, even getting version number can cause this.
I have followed all the suggestions in kubectl unable to connect to server: x509: certificate signed by unknown authority including
- Fetching new credentials using "gcloud container clusters get-credentials my-cluster --region us-east1 "
- I have verified this updates my .kubeconfig
- I have tried deleting the entire .kube folder in my user folder and running above command to regen the file
- I have even uninstalled and re-installed Docker/Kubernetes
- I have tried changing home network, public network, with or without VPN. No consistent behavior.
- Tried adding --insecure-skip-tls-verify
Kubectl Version I am running
PS C:\Users\ak\source\repos\foo> kubectl version Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:38:33Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"windows/amd64"} Unable to connect to the server: x509: certificate signed by unknown authority