「kube-vip」- 常见问题处理

  CREATED BY JENKINSBOT

slice bounds out of range … with capacity …

问题描述

...
time="2022-07-10T02:46:25Z" level=info msg="new leader elected: k8s120-cp122"
time="2022-07-10T02:46:25Z" level=info msg="Node [k8s120-cp122] is assuming leadership of the cluster"
I0710 02:46:31.051943       1 leaderelection.go:258] successfully acquired lease kube-system/plndr-cp-lock
time="2022-07-10T02:46:31Z" level=info msg="Node [k8s120-cp123] is assuming leadership of the cluster"
time="2022-07-10T02:46:31Z" level=info msg="Starting IPVS LoadBalancer"
panic: runtime error: slice bounds out of range [:12] with capacity 0

goroutine 45 [running]:
github.com/cloudflare/ipvs.NewIP(...)
        /go/pkg/mod/github.com/cloudflare/ipvs@v0.0.0-20210114211356-96b2597859b3/ip.go:25
github.com/kube-vip/kube-vip/pkg/loadbalancer.NewIPVSLB(0x0, 0x0, 0x192b, 0x1a, 0x0, 0x0)
        /src/pkg/loadbalancer/ipvs.go:53 +0x779
github.com/kube-vip/kube-vip/pkg/cluster.(*Cluster).vipService(0xc0000de080, 0x1dc0130, 0xc0000b2f00, 0x1dc0130, 0xc0000b2f40, 0x2920480, 0xc0001fd480, 0x0, 0x0, 0x1c281d8, ...)
        /src/pkg/cluster/service.go:81 +0x427
github.com/kube-vip/kube-vip/pkg/cluster.(*Cluster).StartCluster.func3(0x1dc0130, 0xc0000c7080)
        /src/pkg/cluster/clusterLeaderElection.go:194 +0x85
created by k8s.io/client-go/tools/leaderelection.(*LeaderElector).Run
        /go/pkg/mod/k8s.io/client-go@v0.22.2/tools/leaderelection/leaderelection.go:211 +0x11b
...

原因分析

kube-vip v0.4.0

解决方案

版本升级,而后问题得以解决。