[英]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.