Issue with the Kubernetes when using the kubectl commands

3/20/2019

error: Couldn't get available api versions from server: 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\"" }

-- raja
kubernetes

1 Answer

6/27/2019

I spent some time this morning troubleshooting this exact error and it looks like this error is thrown when kubeconfig file is not a valid yaml file.

In my particular case the problems with the file were:

  • "\n" instead of actual line breaks
  • Double-quotes at the begin and end of the file

Config file was auto-generated and fixing both issues allowed kubectl to use it

-- Xantrul
Source: StackOverflow