Kubernetes客户端Go找不到模块 [英] Kubernetes client go couldn't find module
本文介绍了Kubernetes客户端Go找不到模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试连接到minikube
上托管的本地Kubernetes群集,这是相同,现在当我执行go run minikube.go
时,它给了我一个错误:
I'm trying to connect to my local Kubernetes cluster hosted on minikube
, here's the code for the same, now when I do go run minikube.go
, it gives me an error saying:
../../../pkg/mod/k8s.io/client-go@v11.0.0+incompatible/kubernetes/scheme/register.go:26:2: module k8s.io/api@latest found (v0.19.0), but does not contain package k8s.io/api/auditregistration/v1alpha1`.
现在,我尝试使用go get
手动安装软件包,然后发现该软件包不存在.
我如何使其工作并解决此问题?
我的 go.mod文件,以防万一.
Now, I tried to manually install the package using go get
then I found out that this package does not exist.
How can I make it work and fix this?.
My go.mod file in case anyone wants to see that.
推荐答案
始终在go.mod
文件中指定所有三个k8s.io/...组件的匹配版本
Always specify matching versions of all three k8s.io/... components in your go.mod
file
require (
...
k8s.io/api v0.19.0
k8s.io/apimachinery v0.19.0
k8s.io/client-go v0.19.0
...
)
这篇关于Kubernetes客户端Go找不到模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文