当前位置:   article > 正文

kubernetes 1.18.17 windows server 2019 节点 cluster ip 服务不通_windows 2019 kubernate

windows 2019 kubernate

kube-proxy 日志

...
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
  • 2
  • 3

解决

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

2.运行脚本

cd c:\k
.\GetSourceVip.ps1
  • 1
  • 2

修改 kube-proxy.yml

内容见 官方文件
修改获取 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]
  • 1
  • 2
  • 3

重新创建 windows节点的 kube-proxy

利用 kubectl 先删除,再创建即可。

参考

https://github.com/kubernetes/kubernetes/issues/100962

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/601288
推荐阅读
相关标签
  

闽ICP备14008679号