kubectl diff on windows returns an error: executable file not found in PATH
kubectl diff on windows returns an error: executable file not found in PATH
我在 Windows 上使用 Kubectl 时遇到问题:
C:\> kubectl diff -f app.yml
error: executable file not found in %PATH%
Kubernetes 随 Docker 桌面一起安装。同样的错误与文件无关,我将其用作参数(即使 .yml 文件不包含任何内容)。
版本:
C:\> kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:16Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
kubectl diff
命令在后台使用 Unix diff
程序。估计你没有安装这个。您可能可以通过 WSL 或其他您喜欢的方式安装它来获取 Unix-y 程序。
在我的本地机器上安装 DiffUtils for Windows 并重新启动机器后一切正常。
尝试使用 choco 安装 - 无需重新启动 Windows。
choco install diffutils
由于遇到与 OP 基本相同的问题,我的解决方案需要一些额外的步骤:如前所述安装 DiffUtils for Windows,然后在我的 Win10 中映射 bin 文件夹(默认位于 C:\Program Files (x86)\GnuWin32\bin
)路径变量。
我假设 DiffUtils 的安装程序应该映射它,但由于某种原因它未能这样做,导致我不得不手动执行此操作。
我遇到了同样的错误。我在 Windows 10 机器上安装了 git bash。如此尝试,它奏效了。
所以正如@coderanger 提到的,它在后台使用 UNIX diff 程序,git bash 有效
如果您已经安装了首选的 diff 工具,请设置 $Env:KUBECTL_EXTERNAL_DIFF。例如:
$Env:KUBECTL_EXTERNAL_DIFF="C:\Progra~1\WinMerge\WinMergeU.exe"
我在 Windows 上使用 Kubectl 时遇到问题:
C:\> kubectl diff -f app.yml
error: executable file not found in %PATH%
Kubernetes 随 Docker 桌面一起安装。同样的错误与文件无关,我将其用作参数(即使 .yml 文件不包含任何内容)。
版本:
C:\> kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:16Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
kubectl diff
命令在后台使用 Unix diff
程序。估计你没有安装这个。您可能可以通过 WSL 或其他您喜欢的方式安装它来获取 Unix-y 程序。
在我的本地机器上安装 DiffUtils for Windows 并重新启动机器后一切正常。
尝试使用 choco 安装 - 无需重新启动 Windows。
choco install diffutils
由于遇到与 OP 基本相同的问题,我的解决方案需要一些额外的步骤:如前所述安装 DiffUtils for Windows,然后在我的 Win10 中映射 bin 文件夹(默认位于 C:\Program Files (x86)\GnuWin32\bin
)路径变量。
我假设 DiffUtils 的安装程序应该映射它,但由于某种原因它未能这样做,导致我不得不手动执行此操作。
我遇到了同样的错误。我在 Windows 10 机器上安装了 git bash。如此尝试,它奏效了。 所以正如@coderanger 提到的,它在后台使用 UNIX diff 程序,git bash 有效
如果您已经安装了首选的 diff 工具,请设置 $Env:KUBECTL_EXTERNAL_DIFF。例如:
$Env:KUBECTL_EXTERNAL_DIFF="C:\Progra~1\WinMerge\WinMergeU.exe"