我正在按照kubernetes documentation在Ubuntu 16.04中安装minkube 0.19.1。作为先决条件,我已经安装了kubectl和Oracle VirtualBox。
当我用kubectl version
检查kubectl时,它给出了以下内容。
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:34:20Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
但是当我netstat端口检查进程时,它没有为结果提供任何内容。 我也设置了Google云端SDK。
我搜索并尝试了许多包含this的解决方案,但无法解决我的问题。
以下是我的gcloud配置和信息结果。
$gcloud config list
[compute]
zone = asia-southeast1-a
[core]
account = userName@mail.com
disable_usage_reporting = False
project = sampleproject1990
$gcloud info
Google Cloud SDK [159.0.0]
Platform: [Linux, x86_64] ('Linux', 'userName', '4.8.0-54-generic', '#57~16.04.1-Ubuntu SMP Wed May 24 16:22:28 UTC 2017', 'x86_64', 'x86_64')
Python Version: [2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]]
Python Location: [/usr/bin/python2]
Site Packages: [Disabled]
Installation Root: [/home/userName/products/google-cloud-sdk]
Installed Components:
kubectl: []
core: [2017.06.09]
gcloud: []
gsutil: [4.26]
bq: [2.0.24]
alpha: [2017.03.24]
System PATH: [PATH=/usr/lib/jvm/java-8-oracle/bin:/home/userName/bin:/home/userName/.local/bin:/usr/local/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/local/apache-maven-3.3.9/bin]
Python PATH: [/home/userName/products/./google-cloud-sdk/lib/third_party:/home/userName/products/google-cloud-sdk/lib:/usr/lib/python2.7/:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [False]
Kubectl on PATH: [/usr/local/bin/kubectl]
WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
/usr/local/bin/kubectl
Installation Properties: [/home/userName/products/google-cloud-sdk/properties]
User Config Directory: [/home/userName/.config/gcloud]
Active Configuration Name: [my-configuration]
Active Configuration Path: [/home/userName/.config/gcloud/configurations/config_my-configuration]
Account: [userName@mail.com]
Project: [sampleproject1990]
Current Properties:
[core]
project: [sampleproject1990]
account: [userName@mail.com]
disable_usage_reporting: [False]
[compute]
zone: [asia-southeast1-a]
Logs Directory: [/home/userName/.config/gcloud/logs]
Last Log File: [/home/userName/.config/gcloud/logs/2017.06.21/12.39.23.391849.log]
git: [git version 2.7.4]
ssh: [OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016]
有谁能告诉我如何解决这个问题?
答案 0 :(得分:0)
我在使用Minikube和virtualbox驱动程序时遇到过类似的问题。请确保虚拟机配置的接口已启用。
我做了 sudo ifconfig vboxnet0 up
,我的问题得到了解决
答案 1 :(得分:0)
此问题是因为Kubelet未运行或运行状况不佳。
解决此问题的一种方法:
$ sudo swapoff -a
$ sudo systemctl enable kubelet
$ sudo systemctl start kubelet
在此之后,使用Kubernetes
部署kubeadm
,如下所示:
$ sudo kubeadm init --ignore-preflight-errors=all
加载kubeadm凭据后,如果您正在处理群集,请取消主节点并加入工作节点。
现在给出命令:
$ sudo kubectl cluster-info
服务器和客户端应该使用相同的Kubernetes版本运行。
如果此解决方案不起作用,请刮掉Kubernetes,kubectl,kubeadm和kubelet,然后单独执行this指南中的 Kubernetes安装步骤。
答案 2 :(得分:0)
我遇到了同样的问题。原来我没有以root用户身份运行命令。因此,如果您以超级用户(sudo -i)登录,则可能会起作用。