我正在尝试学习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只是在疯狂。
任何帮助都会非常有帮助。
用户@paltaa提到:
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:
- 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:
kubectl
directory to Windows environment variables$ minikube start --vm-driver=virtualbox
$ kubectl get nodes
.请告诉我是否有帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句