error: failed to discover supported resources kubernetes google cloud platform

8/21/2018

I was performing a practical where i was deploying a containerised sample application using kubernetes.

i was trying to run container on google cloud platform using kubernetes engine.But while deploying container using "kubectl run" command using google cloud shell.

its showing an error "error: failed to discover supported resources: Get https://35.240.145.231/apis/extensions/v1beta1: x509: certificate signed by unknown authority".

From Error, i can recollect that its because of "SSL Certificate" not authorised.

I even exported the config file resides at "$HOME/.kube/config". but still getting the same error.

please anyone help me understand the real issue behind this.

Best,

Swapnil Pawar

-- Swapnil978
cloud
google-cloud-platform
google-kubernetes-engine
kubernetes

1 Answer

8/21/2018

You may try following steps,

  1. List all the available clusters,

    $ gcloud container clusters list
  2. Depending upon how you have configured the cluster, if the cluster location is configured for a specific zone then,

    $ gcloud container clusters get-credentials <cluster_name> --ZONE <location>

    or if the location is configured for a region then,

    $ gcloud container clusters get-credentials <cluster_name> --REGION <location>

The above command will update your kubectl config file $HOME/.kube/config

  1. Now, the tricky part. If you have more than one cluster that you have configured, then your $HOME/.kube/config will have two or more entries. You can verify it by doing a cat command on the config file.

To select a particular context/cluster, you need to run the following commands

$ kubectl config get-contexts -o=name // will give you a list of available contexts

$ kubectl config use-context <CONTEXT_NAME>

$ kubectl config set-context <CONTEXT_NAME>

Now, you may run the kubectl run.

-- Narendra
Source: StackOverflow