我在 Windows 10
中安装了 minikube
。我可以启动 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。如果需要,请尝试:'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.
最佳答案
Minikube 在自身内部安装了 kubectl
。
因此,要使用通过 minikube 安装的 kubectl
,您必须在命令参数前加上 minikube kubectl --
。例如:
# the same as `kubectl version --client`
minikube kubectl -- version --client
为方便起见,您可能希望在 shell 配置中添加一个别名。
关于kubernetes - `kubectl` 未找到。如果需要,试试: 'minikube kubectl -- get pods -A' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65037796/