while I'm trying to get the pods or node states , from GCP Cloud Shell, I'm facing this error? can someone please help me? but i can see the output of the "kubectl config view" .
Posting this answer as community wiki for better visibility and the fact that the possible solution was posted in the comments:
Does this answer your question? Unable to connect to the server: dial tcp i/o time out
Adding to that:
Below command:
$ kubectl config view
is used to show the configuration stored in your ./kube/config
file. The fact that you can see the output of this command doesn't mean you have correct cluster configured to use with kubectl
.
From the perspective of Google Cloud Platform
and Cloud Shell
There is an official documentation regarding troubleshooting issues with GKE
:
There could be several reasons why you are getting following error:
~/.kube/config
file. $ gcloud container cluster get-credentials CLUSTER_NAME --zone=ZONE
- you will need to run this command to fetch the correct configurationKubernetes Engine
page (Connect
button) ~/.kube/config
file that was deleted For more information you can look in the Cloud Console -> Kubernetes Engine -> CLUSTER_NAME
You can also run:
$ gcloud container clusters list
- this command will show clusters and their state (status) they are in$ gcloud container clusters describe CLUSTER_NAME --zone=ZONE
- this command will show you the configuration of the cluster