kubectl run命令失败并出现连接拒绝错误

Dis*_*ile 3 kubernetes

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

http://kubernetes.io/docs/hellonode/

我在尝试执行"创建您的广告连播"部分时遇到错误.

当我运行此命令(用我创建的PROJECT_ID替换PROJECT_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?
Run Code Online (Sandbox Code Playgroud)

我只是输入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?
Run Code Online (Sandbox Code Playgroud)

我不知道该怎么做,因为除了遵循本教程的步骤之外我没有使用kubernetes的经验.

Dis*_*ile 5

我想出了这个问题.在这Create your cluster节我错过了一个关键步骤.

我错过的步骤是: Please ensure that you have configured kubectl to use the cluster you just created.配置的部分是如何执行此操作的链接:

步骤如下:

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
Run Code Online (Sandbox Code Playgroud)