kubectl无法在本地用minikube检测到localhost:8080

时间:2019-05-01 09:40:59

标签: kubernetes kubectl

我正在尝试通过ubuntu 18计算机在https://kubernetes.io/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive/上本地运行该教程。

$ minikube start
      minikube v1.0.1 on linux (amd64)
      Downloading Kubernetes v1.14.1 images in the background ...
      Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
      "minikube" IP address is 192.168.39.247
      Configuring Docker as the container runtime ...
      Version of container runtime is 18.06.3-ce
    ⌛  Waiting for image downloads to complete ...
    ✨  Preparing Kubernetes environment ...
      Downloading kubeadm v1.14.1
      Downloading kubelet v1.14.1
      Pulling images required by Kubernetes v1.14.1 ...
      Launching Kubernetes v1.14.1 using kubeadm ... 
    ⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
      Configuring cluster permissions ...
      Verifying component health .....
      kubectl is now configured to use "minikube"
      Done! Thank you for using minikube!

到目前为止,太好了。 接下来,我尝试运行

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

的相似响应
$ kubectl cluster-info

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server localhost:8080 was refused - did you specify the right host or port?

也是

$ kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

我想念什么?

1 个答案:

答案 0 :(得分:0)

好的,所以我自己就能找到答案。

〜/ .kube / config之前已经存在,所以我先将其删除。

接下来,当我再次运行命令时,再次创建了一个配置文件,其中提到端口为8443。

因此,在启动minikube之前,需要确保没有旧的〜/ .kube / config文件。