Kubernetes-与服务器localhost:8080的连接被拒绝-您是否指定了正确的主机或端口? [英] Kubernetes - The connection to the server localhost:8080 was refused - did you specify the right host or port?

查看:953
本文介绍了Kubernetes-与服务器localhost:8080的连接被拒绝-您是否指定了正确的主机或端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚通过Ubuntu 64 (Linux)完成了kubectl的安装. 我遵循了在线Kubernetes指南,但是主机出现错误.第一步(安装kubectl)之后,当我检查kubectl版本时,这是消息(我尚未安装和部署minikube,因为我没有根据此问题进行连接):

I just finished installing kubectl via Ubuntu 64 (Linux). I followed the online Kubernetes guide, but I've had an error with the host. After the first step (install kubectl), when I checked the kubectl version, this was the message (I didn't yet install and deploy the minikube because I've not the connection according to this problem):

root@ubuntu:~# kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

有人有同样的问题吗?我该如何解决?

Does someone have the same problem? How can I fix it?

推荐答案

其背后的原因是kubectl version会同时打印Client VersionServer Version(kubernetes版本).当您只安装kubectl时,它只是kubernets客户端.如果您安装了kubernetes集群,它将同时打印kubectl版本和kubernetes版本.

The reason behind that is kubectl version prints Client Version and Server Version (kubernetes version) both. When you just install kubectl it is just kubernets client. If you have kubernetes cluster installed, it will print both kubectl version and kubernetes version.

如果只想打印客户端版本,请使用以下命令:

If you want to just want to print client version, then use following command:

kubectl version --client=true

该错误表示kubectl tried to contact the kubernetes server to get its version but couldn't connect. Are you specifying the right host or port to connect to the kubernetes server.

该错误背后的原因是您尚未在Mac上安装kubernetes集群.您刚刚安装了kubectl,它只是访问kubernetes集群的客户端.一旦安装了kubernetes集群,kubectl版本的输出将像这样:

The reason behind the error is you have not installed kubernetes cluster on you mac. You just installed kubectl which is just a client to access kubernetes cluster. Once you install the kubernetes cluster the output of kubectl version will be like:

[root@ip-10-0-1-138 centos]# kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", 
GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:05:37Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

如果要在Mac上安装完整的kubernetes集群,请尝试 minikube 进行安装本地集群.

If you want to install the complete kubernetes cluster on mac, please try minikube to install cluster locally.

这篇关于Kubernetes-与服务器localhost:8080的连接被拒绝-您是否指定了正确的主机或端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆