赞
踩
...
E0409 13:34:34.816950 3560 proxier.go:998] "Source Vip endpoint creation failed" err="hcnCreateEndpoint failed in Win32: An address provided is invalid or reserved. (0x803b002f) {\"Success\":false,\"Error\":\"An address provided is invalid or reserved. \",\"ErrorCode\":2151350319}"
...
1.把下面的脚本保存为 c:\k\GetSourceVip.ps1
<# #> Param( [parameter(HelpMessage="network name")] [string] $NetworkName = "flannel.4096" ) function GetSourceVip($ipaddress, $NetworkName) { $hnsNetwork = Get-HnsNetwork | ? Name -EQ $NetworkName.ToLower() $subnet = $hnsNetwork.Subnets[0].AddressPrefix $ipamConfig = @" {"cniVersion": "0.2.0", "name": "vxlan0", "ipam":{"type":"host-local","ranges":[[{"subnet":"$subnet"}]],"dataDir":"/var/lib/cni/networks"}} "@ $ipamConfig | Out-File "C:\k\sourceVipRequest.json" $env:CNI_COMMAND="ADD" $env:CNI_CONTAINERID="dummy" $env:CNI_NETNS="dummy" $env:CNI_IFNAME="dummy" $env:CNI_PATH="c:\opt\cni" #path to host-local.exe If(!(Test-Path c:/k/sourceVip.json)) { Get-Content sourceVipRequest.json | c:\opt\cni\bin\host-local.exe | Out-File sourceVip.json } Remove-Item env:CNI_COMMAND Remove-Item env:CNI_CONTAINERID Remove-Item env:CNI_NETNS Remove-Item env:CNI_IFNAME Remove-Item env:CNI_PATH } GetSourceVip "" $NetworkName
2.运行脚本
cd c:\k
.\GetSourceVip.ps1
内容见 官方文件。
修改获取 sourceVip 的代码:
#$sourceVip = ($env:POD_IP -split "\.")[0..2] + 2 -join "."
$sourceVipJSON = (Get-Content "/host/k/sourceVip.json" | ConvertFrom-Json)
$sourceVip = $sourceVipJSON.ip4.ip.Split("/")[0]
利用 kubectl 先删除,再创建即可。
https://github.com/kubernetes/kubernetes/issues/100962
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。