【发布时间】:2018-12-24 05:50:30
【问题描述】:
我正在尝试通过 Go API 从正在运行的 pod 内部连接到 OpenShift/K8s 集群。因此,我正在关注here 的教程。
目前,我在创建 OpenShift 构建客户端时遇到问题,其构造函数获取先前创建的 rest.InClusterConfig() 作为参数。这应该工作,因为它显示在示例中,但我收到此错误:
cannot use restconfig (type *"k8s.io/client-go/rest".Config) as type *"github.com/openshift/client-go/vendor/k8s.io/client-go/rest".Config in argument to "github.com/openshift/client-go/build/clientset/versioned/typed/build/v1".NewForConfig
我有点困惑,因为rest.InClusterConfig() 返回一个*Config。这在 corev1client.NewForConfig() 中被接受,它需要 *rest.Config。但buildv1client.NewForConfig() 也需要*rest.Config - 但不完全是我用rest.InClusterConfig() 创建的restconfig。
我的错误在哪里?加分项:我正在使用 API 迈出第一步,它应该做的就是从应用了一些参数的图像生成第二个 pod。我需要buildv1client 客户端吗?这几乎是 Kubernetes 的核心功能。
【问题讨论】:
标签: go kubernetes openshift