在Windows 10 Home上设置KUBECTL时出现问题

RDM

我正在尝试学习Kubernetes,因此我在本地Windows 10 Home计算机上安装了Minikube,然后尝试安装kubectl。但是到目前为止,我一直没有成功解决问题。因此,到目前为止,我已经这样做了:从https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe下载了kubectl.exe文件

然后我在path environment variable如下所示添加此exe的路径在此处输入图片说明

但是,当我kubectl version在命令提示符下甚至在pwoershell(在管理员模式下)执行时,此方法不起作用

接下来,我尝试使用文档中给出的curl命令-https: //kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-with-curl-on-windows

但是,如下所示,它也不起作用: 在此处输入图片说明

在寻找解决问题的答案时,我偶然发现了这个StackOverfow问题问题解释了如何创建.kube配置文件夹,因为该文件夹在我的本地计算机上不存在。我遵循了指示,但是那也失败了。

在此处输入图片说明 在此处输入图片说明

因此,现在我完全没有主意,也不知道这里出了什么问题。仅供参考,我可以轻松地在Mac上安装所有内容,但是Windows只是在疯狂。

任何帮助都会非常有帮助。

戴维德·克鲁克(Dawid Kruk)

用户@paltaa提到:

你做了minikube start吗?paltaa 2天前

The fact that you did not start the minikube is the most probable cause why you are getting this error.


Additionally this error message shows when the minikube is stopped as stopping will change the current-context inside the config file.


There is no need to create a config file inside of a .kube directory as the minikube start will create appropriate files and directories for you automatically.

If you run minikube start command successfully you should get below message at the end of configuration process which will indicate that the kubectl is set for minikube automatically.

Done! kubectl is not configured to use "minikube"

Additionally if you invoke command $ kubectl config you will get more information how kubectl is looking for configuration files:

 The loading order follows these rules:

  1.  If the --kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes
place.
  2.  If $KUBECONFIG environment variable is set, then it is used as a list of paths (normal path delimiting rules for
your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When
a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the
last file in the list.
  3.  Otherwise, ${HOME}/.kube/config is used and no merging takes place.

Please take a special look on part:

  1. Otherwise, ${HOME}/.kube/config is used

Even if you do not set the KUBECONFIG environment variable kubectl will default to $USER_DIRECTORY (for example C:\Users\yoda\.

If for some reason your cluster is running and files got deleted/corrupted you can:

  • minikube stop
  • minikube start

which will recreate a .kube/config


Steps for running minikube on Windows in this case could be:

  • Download and install Kubernetes.io: Install minikube using an installer executable
  • Download, install and configure a Hypervisor (for example Virtualbox)
  • Download kubectl
    • OPTIONAL: Add the kubectl directory to Windows environment variables
  • Run from command line or powershell from current user: $ minikube start --vm-driver=virtualbox
  • Wait for configuration to finish and invoke command like $ kubectl get nodes.

请告诉我是否有帮助。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在Windows 10上安装Kivy时出现问题

来自分类Dev

在Windows 10上安装Tensorflow时出现问题

来自分类Dev

在Windows 10上观看视频时出现问题

来自分类Dev

在Windows 10上安装Ubuntu 16.04时出现问题

来自分类Dev

在Windows 10上为PyPy3安装numpy时出现问题

来自分类Dev

在Windows 10 Pro上安装Hyper-V功能时出现问题

来自分类Dev

在Windows 10上安装BootCamp驱动程序时出现问题

来自分类Dev

绘制Windows 10字幕按钮时出现问题

来自分类Dev

Windows 10:使用提供的Powershell脚本注册Filebeat服务时出现问题

来自分类Dev

在Windows 10上格式化我的可启动USB Pendrive时出现问题

来自分类Dev

尝试卸载 Ubuntu 19.04 并安装 Windows 10 时出现问题

来自分类Dev

Windows 10 UWP的图块和图标出现问题?

来自分类Dev

在PyCharm,Windows上安装Kivy时出现问题

来自分类Dev

在Windows 8上刻录Live CD时出现问题

来自分类Dev

在Windows 7上安装JSCover 0.2.0时出现问题

来自分类Dev

在Windows7上安排任务时出现问题

来自分类Dev

Windows 10上的Postgres问题

来自分类Dev

Kubectl 无法在 Windows 10 上连接

来自分类Dev

Windows 10 DNS问题

来自分类Dev

Windows 10内存问题

来自分类Dev

Windows 10搜索问题

来自分类Dev

Windows 10激活问题

来自分类Dev

Windows 10:蓝屏问题

来自分类Dev

Windows 10 VPN问题

来自分类Dev

Windows 10睡眠问题

来自分类Dev

WebStorm / PhpStorm,在Windows 10上出现终端问题

来自分类Dev

在Windows 10上扫描

来自分类Dev

Windows 10上的电子

来自分类Dev

Windows 10 上的 CppFlow