Kubernetes kubectl run命令失败,出现连接被拒绝错误

Kubernetes kubectl run命令失败,出现连接被拒绝错误,kubernetes,Kubernetes,我正在关注关于kubernetes.io的hellonode教程 我在尝试执行“创建你的pod”部分时出错 当我运行此命令(用我创建的项目_ID替换项目_ID)时,我得到以下结果: $ kubectl run hello-node --image=gcr.io/PROJECT_ID/hello-node:v1 --port=8080 The connection to the server localhost:8080 was refused - did you specify the ri

我正在关注关于kubernetes.io的hellonode教程

我在尝试执行“创建你的pod”部分时出错

当我运行此命令(用我创建的项目_ID替换项目_ID)时,我得到以下结果:

$ kubectl run hello-node --image=gcr.io/PROJECT_ID/hello-node:v1 --port=8080

The connection to the server localhost:8080 was refused - did you specify the right host or port?
我在键入kubectl版本时遇到类似错误:

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.2", GitCommit:"528f879e7d3790ea4287687ef0ab3f2a01cc2718", GitTreeState:"clean"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
我不知道该怎么办,因为除了遵循本教程的步骤之外,我对kubernetes没有任何经验。

我解决了这个问题。 在
创建集群
部分,我错过了一个关键步骤

我错过的步骤是:
请确保您已将kubectl配置为使用刚刚创建的群集。
配置的部分是如何执行此操作的链接:

步骤如下:

gcloud config set project PROJECT
gcloud config set compute/zone ZONE
gcloud config set container/cluster CLUSTER_NAME
gcloud container clusters get-credentials CUSTER_NAME

嗨,我也遇到了同样的问题,但无法通过以下方式解决。但它仍然给出了相同的错误。与服务器localhost:8080的连接被拒绝-是否指定了正确的主机或端口?还有其他原因吗?