kubernetes client-go依赖报错

网友投稿 253 2022-10-28

kubernetes client-go依赖报错

初次使用kubenetes client-go来学习遇到的问题。代码使用github 练习:examples/out-of-cluster-client-configuration/main.go使用go build -o app . 出现以下错误

# k8s.io/client-go/tools/clientcmd/api/v1 D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:29:15: scheme.AddConversionFuncs undefined (type *runtime.Scheme has no field or method AddConversionFuncs) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:31:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:34:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:37:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:40:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:43:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:46:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:49:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\tools\clientcmd\api\v1\conversion.go:52:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) # k8s.io/client-go/rest D:\software\gotest\pkg\mod\k8s.io\client-go@v11.0.0+incompatible\rest\request.go:598:31: not enough arguments in call to watch.NewStreamWatcher

golang version:1.14client-go version: 1.18修改go.mod 文件,替换k8s.io\client-go@v11.0.0+incompatible为k8s.io/client-go v0.18.2,然后在go build就可以了,github issue中解释如下:

Related issue is that go get k8s.io/client-go@latest resolves to v11.0.0+incompatible not v0.18.2. Should I break this off as a separate discussion? Unfortunately, that is not possible to resolve. k8s.io/client-go had major versions tagged prior to the introduction of go modules. go modules require any major version X >= 2 rename the module to k8s.io/client-go/v. Go considers tags >= 2.x.x which contain a go.mod file with a module name that doesn't end with /v invalid and won't include them when resolving @latest, so until the k8s.io/client-go module is renamed with version suffixes, go get must indicate specific versions (e.g. go get k8s.io/client-go@v0.18.2)

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:GPIB-RS232C接口转换设计及应用概述
下一篇:Docker搭建Harbor公开仓库
相关文章

 发表评论

暂时没有评论,来抢沙发吧~