[英]`kubectl` not found. If you need it, try: 'minikube kubectl -- get pods -A'
我在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**
但是上面 output (倒數第二行)有一個警告說kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
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.
你已經安裝了minikube
, kubectl
不是 minikube package 的一部分。
它說當您執行minikube start
時kubectl
不存在,如果需要,您可以使用minikube kubectl
代替。
這也提到here
If you already have kubectl installed, you can now use it to access your shiny new cluster
在 Linux 上遇到了同樣的問題。
minikube kubectl -- get po -A
kubectl version --client
zsh: command not found: kubectl
Minikube 在自身內部安裝kubectl
。 因此,您不能只運行命令kubectl
。
要使用通過 minikube 安裝的kubectl
,您必須在命令 arguments 前面加上minikube kubectl --
。 例如:
# the same as `kubectl version --client`
minikube kubectl -- version --client
為方便起見,您可能希望在 shell 配置中添加別名。
這意味着 kubectl 可能不存在於您的機器上,或者它沒有添加到您的 PATH 中。
您可以按照以下說明通過下載可執行文件或使用curl
來安裝它:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/windows/amd64/kubectl.exe
之后將二進制文件添加到 PATH 。
您可以運行kubectl version --client
以確保下載正確的版本。
kubectl
包裹在minikube
周圍。
不要忘記在minikube kubectl
之后添加--
minikube kubectl -- describe pod kube-scheduler-minikube --namespace kube-system
minikube kubectl -- get pods --namespace kube-system
使用 doskey.exe 為 kubectl 創建一個別名。
例子:
doskey kubectl="%PROGRAMFILES%\Kubernetes\Minikube\minikube.exe" kubectl -- $*
如果您在其他地方安裝了 minikube,您可能需要更新路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.