【问题标题】:kubectl run command is failing with a connection refused errorkubectl run 命令因连接被拒绝错误而失败
【发布时间】:2016-08-19 03:20:10
【问题描述】:

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

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

我在尝试执行“创建您的 pod”部分时遇到错误。

当我运行此命令时(将 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?

我在输入 kubectl version 时遇到了类似的错误:

$ 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 的经验。

【问题讨论】:

    标签: kubernetes


    【解决方案1】:

    我发现了这个问题。 在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
    

    【讨论】:

    • 嗨,我遇到了同样的问题,但无法通过以下方式解决。它仍然给出了同样的错误。与服务器 localhost:8080 的连接被拒绝 - 您是否指定了正确的主机或端口?会有其他原因吗?
    猜你喜欢
    • 1970-01-01
    • 2019-01-03
    • 2017-11-23
    • 2016-07-25
    • 1970-01-01
    • 1970-01-01
    • 2012-01-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多