kubernetes - "kubectl" 从 PowerShell 在 Windows 上安装失败
kubernetes - "kubectl" installation fails on Windows from PowerShell
根据文档 https://kubernetes.io/docs/tasks/tools/install-kubectl 在 windows 上安装应该非常简单,但我的安装在第二步失败
Install-Script -Name 'install-kubectl' -Scope CurrentUser -Force
install-kubectl.ps1 [-DownloadLocation <path>]
install-kubectl.ps1 c:\kubectl
==>Getting download link from https://kubernetes.io/docs/tasks/tools/install-kubectl/
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At C:\Program Files\PowerShell\Scripts\install-kubectl.ps1:31 char:8
+ $req = Invoke-WebRequest -UseBasicParsing -Uri $uri
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
它似乎正在尝试从 https://kubernetes.io/docs/tasks/tools/install-kubectl/ 下载某些东西,但它不能。
我成功检查了该连接,我确实可以从该 Windows 服务器访问互联网:
PS C:\Users\e561> Test-NetConnection -ComputerName "kubernetes.io" -Port 443
ComputerName : kubernetes.io
RemoteAddress : 147.75.40.148
RemotePort : 443
InterfaceAlias : Ethernet 2
SourceAddress : 10.7.147.211
TcpTestSucceeded : True
如评论中所述:
您可以从 here 下载 kubectl.exe
- 然后将位于 kubectl.exe
的路径添加到环境变量。
根据文档 https://kubernetes.io/docs/tasks/tools/install-kubectl 在 windows 上安装应该非常简单,但我的安装在第二步失败
Install-Script -Name 'install-kubectl' -Scope CurrentUser -Force
install-kubectl.ps1 [-DownloadLocation <path>]
install-kubectl.ps1 c:\kubectl
==>Getting download link from https://kubernetes.io/docs/tasks/tools/install-kubectl/
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At C:\Program Files\PowerShell\Scripts\install-kubectl.ps1:31 char:8
+ $req = Invoke-WebRequest -UseBasicParsing -Uri $uri
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
它似乎正在尝试从 https://kubernetes.io/docs/tasks/tools/install-kubectl/ 下载某些东西,但它不能。
我成功检查了该连接,我确实可以从该 Windows 服务器访问互联网:
PS C:\Users\e561> Test-NetConnection -ComputerName "kubernetes.io" -Port 443
ComputerName : kubernetes.io
RemoteAddress : 147.75.40.148
RemotePort : 443
InterfaceAlias : Ethernet 2
SourceAddress : 10.7.147.211
TcpTestSucceeded : True
如评论中所述:
您可以从 here 下载 kubectl.exe
- 然后将位于 kubectl.exe
的路径添加到环境变量。