Kubernetes client go couldn't find module

时间秒杀一切 提交于 2021-02-19 02:38:06

问题


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`.

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.


回答1:


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
    ...
)


来源:https://stackoverflow.com/questions/63655419/kubernetes-client-go-couldnt-find-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!