简体   繁体   English

GCP GKE Google Kube.netes Engine 与服务器 localhost:8080 的连接被拒绝

[英]GCP GKE Google Kubernetes Engine The connection to the server localhost:8080 was refused

i am trying GCP and GKE google kube.netes engine.我正在尝试 GCP 和 GKE google kube.netes 引擎。 1-)i am create a cluster 2-)i opened cloud shell and used command "kubectl get nodes" 1-) 我正在创建一个集群 2-) 我打开了云 shell 并使用了命令“kubectl get nodes”

i get this error: "The connection to the server localhost:8080 was refused - did you specify the right host or port?"我收到此错误:“与服务器 localhost:8080 的连接被拒绝 - 您是否指定了正确的主机或端口?”

how can i solve.我该如何解决。 thanks.谢谢。

You must have a local Kube.netes config file that is used by kubectl to access cluster(s).您必须具有kubectl用于访问集群的本地 Kube.netes 配置文件。

Conventionally, the config file is called config (YAML) and is found in ${HOME}/.kube/config .按照惯例,配置文件称为config (YAML),位于${HOME}/.kube/config中。

Google provides a way to generate a config file (and context) for you. Google 提供了一种为您生成配置文件(和上下文)的方法。 To do this run gcloud container clusters get-credentials... .为此运行gcloud container clusters get-credentials... You'll need to fill in the blanks of the cluster name and probably the project, zone/region etc.:您需要填写集群名称的空白,可能还有项目、区域/区域等:

gcloud container clusters get-credentials ${CLUSTER_NAME} \
--project=${PROJECT} \
--region=${REGION}

After running this command, you should be able to more ${HOME}/.kube/config and you should be able to access the cluster using eg kubectl get nodes .运行此命令后,您应该能够访问more ${HOME}/.kube/config并且您应该能够使用例如kubectl get nodes访问集群。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “与服务器 localhost:8080 的连接被拒绝 - 您是否指定了正确的主机或端口?” - "The connection to the server localhost:8080 was refused - did you specify the right host or port?" Google Cloud Engine 上的代码服务器 (Visual Studio Code) - ERR_CONNECTION_REFUSED - Code server (Visual Studio Code) on Google Cloud Engine - ERR_CONNECTION_REFUSED 如何使用 kubectl 在 Google Kube.netes Engine (GKE) 集群之间切换? - How can I switch between Google Kubernetes Engine (GKE) clusters with kubectl? 如何使用 ingress-nginx controller 在 Google Kube.netes Engine (GKE) 上向外部公开 UDP 服务? - How do I expose a UDP service externally on Google Kubernetes Engine (GKE) using the ingress-nginx controller? 在 Google Compute Engine 上打开端口 8080 - Open port 8080 on Google Compute Engine 虽然解决了外部 ip,但网站在 kube.netes GKE 中返回连接超时 - Though external ip is resolved, the website returns connection timedout in kubernetes GKE 谷歌 Kube.netes 引擎到云端 SQL - Google Kubernetes Engine to Cloud SQL SQLSTATE[HY000] [2002] 在 GCP 上部署时连接被拒绝 - SQLSTATE[HY000] [2002] Connection refused when deploy on GCP 弹性 APM 错误 | 谷歌 Kubernetes 引擎 - Elastic APM Error | Google Kubernetes Engine http -> https 在 Google Kubernetes 引擎中重定向 - http -> https redirect in Google Kubernetes Engine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM