Warm tip: This article is reproduced from serverfault.com, please click

kubernetes-找不到`kubectl`。

(kubernetes - `kubectl` not found. If you need it, try: 'minikube kubectl -- get pods -A')

发布于 2020-11-27 12:59:41

我安装minikube在中Windows 10我可以开始minikube

**C:\WINDOWS\system32>minikube start
* minikube v1.15.1 on Microsoft Windows 10 Pro 10.0.18363 Build 18363
* Using the hyperv driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing hyperv VM for "minikube" ...
* Preparing Kubernetes v1.19.4 on Docker 19.03.13 ...
* Verifying Kubernetes components...
* Enabled addons: storage-provisioner, default-storageclass
* kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default**

但是上面的输出中有一个警告(第二行)说 kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'

之后,我也执行了此命令 minikube kubectl -- get pods -A

尝试时仍然低于错误 kubectl

C:\WINDOWS\system32>kubectl
'kubectl' is not recognized as an internal or external command,
operable program or batch file.
Questioner
Arun
Viewed
11
Mariusz K. 2020-11-27 22:47:09

这意味着kubectl可能不存在于你的计算机上,或者没有被添加到你的PATH中。

你可以按照以下说明进行安装,方法是下载可执行文件或使用curl

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/windows/amd64/kubectl.exe

之后,将二进制文件添加到PATH

你可以运行kubectl version --client以确保下载了正确的版本。