Reputation: 1452
Suddenly kubectl with gcloud is failing. kubectl was using an old build from 2021 but I upgraded it to see if that fixes the error.
gcloud container clusters get-credentials {hahaNotTellingYouMyClusterName} --zone us-central1-a --project {hahaNotTellingYouMyProjectName}
kubectl get ns
error: couldn't get version/kind; json parse error: json: cannot unmarshal string into Go value of type struct { APIVersion string "json:\"apiVersion,omitempty\""; Kind string "json:\"kind,omitempty\"" }
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:"darwin/amd64"}
error: unable to parse the server version: invalid character '<' looking for beginning of value
I tried:
My kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ****
server: ****
name: ****
contexts:
- context:
cluster: ****
user: ****
name: ****
current-context: ****
kind: Config
preferences: {}
users:
- name: ****
user:
auth-provider:
config:
access-token: ****
cmd-args: config config-helper --format=json
cmd-path: /Users/{myLocalMacUserName}/Tools/gcloud/google-cloud-sdk/bin/gcloud
expiry: "2022-02-18T18:46:38Z"
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp
Upvotes: 2
Views: 14560
Reputation: 1452
Thanks to @DazWilkin who asked if the "server" section is correct. In my case, "server" was an IP i.e. 1.2.3.4. I did a curl -k -v https://1.2.3.4 and found that it was returning a HTTP 302 Moved Temporarily error. I found that my company's internal SSO was broken and even though I was signed in, it was redirecting that 1.2.3.4 to SSO url.
Upvotes: 4