Kubectl don't allow view resources in cluster from node in GCP

5/20/2020

I have a trouble that i can't solve. So, I have k8s cluster on GCP. I can use kubectl from shell That opened directly to cluster. But when I use kubectl from node "I have The connection to the server localhost:8080 was refused - did you specify the right host or port?". Also I use ./kube/config and it works about 5 minutes, and then again fail. Maybe someone use GCP and help me. Thank you.

-- kirill_skorik
google-cloud-platform
kubectl
kubernetes

2 Answers

5/22/2020

If you didn't use COS(Container-Optimized OS), your need to

gcloud container clusters get-credentials "CLUSTER NAME"

By default COS will get credentials when you access to the node.

-- RammusXu
Source: StackOverflow

5/21/2020

irvifa- I use Kubernetes cluster that provides GCP. When I connect directly from cloud shell. But when I connect from instance kubectl shows for client but for server it has mistake The connection to the server localhost:8080 was refused - did you specify the right host or port?"

-- kirill_skorik
Source: StackOverflow