使用client-go mod报错
报错版本不匹配:k8s.io/client-go/kubernetes: module k8s.io/client-go@latest found (v1.5.2), but does not contain package k8s.io/client-go/kubernetes
·
报错信息:
E:\github\client-go>go mod tidy
go: finding module for package k8s.io/client-go/kubernetes
go: finding module for package k8s.io/client-go/tools/clientcmd
go: finding module for package k8s.io/apimachinery/pkg/apis/meta/v1
go: found k8s.io/apimachinery/pkg/apis/meta/v1 in k8s.io/apimachinery v0.22.2
go: finding module for package k8s.io/client-go/kubernetes
go: finding module for package k8s.io/client-go/tools/clientcmd
client-go imports
k8s.io/client-go/kubernetes: module k8s.io/client-go@latest found (v1.5.2), but does not contain package k8s.io/client-go/kubernetes
client-go imports
k8s.io/client-go/tools/clientcmd: module k8s.io/client-go@latest found (v1.5.2), but does not contain package k8s.io/client-go/tools/clientcmd
解决办法:
始终指定三个文件在go.mod文件中
require (
...
k8s.io/api v0.19.0
k8s.io/apimachinery v0.19.0
k8s.io/client-go v0.19.0
...
)
更多推荐
已为社区贡献13条内容
所有评论(0)