Virtual-kubelet 安装失败,缺少文件?

Virtual-kubelet 安装失败,缺少文件?

我已经使用 kubeadm 安装了有 2 个工作进程的 kubernetes 集群

kubernetes 工作正常,但是当我开始了解 virtual-kubelet 时,文档只说得那么简单:

mkdir -p ${GOPATH}/src/github.com/virtual-kubelet
cd ${GOPATH}/src/github.com/virtual-kubelet
git clone https://github.com/virtual-kubelet/virtual-kubelet
cd virtual-kubelet && make build

我已经安装了 go 并将 GOPATH 设置为 /root/go

当我跑步时进行构建发生这样的事:

cmd/virtual-kubelet/main.go:26:2: cannot find package "github.com/sirupsen/logrus" in any of:
        /usr/lib/go-1.10/src/go.opencensus.io/zpages (from $GOROOT)
        /root/go/src/k8s.io/apimachinery/pkg/runtime (from $GOPATH)
        /root/go/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1 (from $GOPATH)
        /root/go/src/k8s.io/client-go/util/retry (from $GOPATH)
node/pod.go:28:2: cannot find package "k8s.io/client-go/util/workqueue" in any of:
        /root/go/src/k8s.io/client-go/util/workqueue (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/flag.go:25:2: cannot find package "k8s.io/klog" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/apis/core (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/apis/core (from $GOPATH)
node/env.go:29:2: cannot find package "k8s.io/kubernetes/pkg/apis/core/pods" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/apis/core/pods (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core/pods (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/apis/core/pods (from $GOPATH)
node/env.go:30:2: cannot find package "k8s.io/kubernetes/pkg/apis/core/v1/helper" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/apis/core/v1/helper (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core/v1/helper (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/apis/core/v1/helper (from $GOPATH)
node/env.go:31:2: cannot find package "k8s.io/kubernetes/pkg/fieldpath" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/fieldpath (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/fieldpath (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/fieldpath (from $GOPATH)
node/api/stats.go:23:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (from $GOPATH)
node/env.go:32:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/envvars" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/kubelet/envvars (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/envvars (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/kubelet/envvars (from $GOPATH)
        /root/go/src/k8s.io/client-go/util/retry (from $GOPATH)
        /usr/lib/go-1.10/src/k8s.io/client-go/util/workqueue (from $GOROOT)
        /root/go/src/k8s.io/client-go/util/workqueue (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/flag.go:25:2: cannot find package "k8s.io/klog" in any of:
        /root/go/src/vendor/k8s.io/klog (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/klog (from $GOROOT)
        /root/go/src/k8s.io/klog (from $GOPATH)
node/api/exec.go:29:2: cannot find package "k8s.io/kubernetes/pkg/apis/core" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/apis/core (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/apis/core (from $GOPATH)
node/env.go:29:2: cannot find package "k8s.io/kubernetes/pkg/apis/core/pods" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/apis/core/pods (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core/pods (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/apis/core/pods (from $GOPATH)
node/env.go:30:2: cannot find package "k8s.io/kubernetes/pkg/apis/core/v1/helper" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/apis/core/v1/helper (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core/v1/helper (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/apis/core/v1/helper (from $GOPATH)
node/env.go:31:2: cannot find package "k8s.io/kubernetes/pkg/fieldpath" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/fieldpath (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/fieldpath (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/fieldpath (from $GOPATH)
node/api/stats.go:23:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (from $GOPATH)
node/env.go:32:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/envvars" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/kubelet/envvars (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/envvars (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/kubelet/envvars (from $GOPATH)
node/api/exec.go:30:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/server/remotecommand" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/pkg/kubelet/server/remotecommand (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/server/remotecommand (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/pkg/kubelet/server/remotecommand (from $GOPATH)
node/env.go:33:2: cannot find package "k8s.io/kubernetes/third_party/forked/golang/expansion" in any of:
        /root/go/src/vendor/k8s.io/kubernetes/third_party/forked/golang/expansion (vendor tree)
        /usr/lib/go-1.10/src/k8s.io/kubernetes/third_party/forked/golang/expansion (from $GOROOT)
        /root/go/src/k8s.io/kubernetes/third_party/forked/golang/expansion (from $GOPATH)
Makefile:40: recipe for target 'build' failed
make: *** [build] Error 1

问题:安装 virtual-kubelet 时我缺少什么?我该如何修复?

P/s:我还为虚拟 kubelet 提供商安装了​​ openstack-zun

版本 1.1:

我尝试以另一个非 root 用户身份安装并转到 1.14.6

go@nginx:~/go/src/github.com/virtual-kubelet$ cd virtual-kubelet && make build
/bin/bash: kubectl: command not found
Building...
cmd/virtual-kubelet/internal/commands/root/tracing_register_jaeger.go:23:2: cannot find package "contrib.go.opencensus.io/exporter/jaeger" in any of:
    /usr/lib/go-1.10/src/contrib.go.opencensus.io/exporter/jaeger (from $GOROOT)
    /home/go/go/src/contrib.go.opencensus.io/exporter/jaeger (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/tracing_register_ocagent.go:22:2: cannot find package "contrib.go.opencensus.io/exporter/ocagent" in any of:
    /usr/lib/go-1.10/src/contrib.go.opencensus.io/exporter/ocagent (from $GOROOT)
    /home/go/go/src/contrib.go.opencensus.io/exporter/ocagent (from $GOPATH)
node/pod.go:20:2: cannot find package "github.com/google/go-cmp/cmp" in any of:
    /usr/lib/go-1.10/src/github.com/google/go-cmp/cmp (from $GOROOT)
    /home/go/go/src/github.com/google/go-cmp/cmp (from $GOPATH)
node/api/exec.go:24:2: cannot find package "github.com/gorilla/mux" in any of:
    /usr/lib/go-1.10/src/github.com/gorilla/mux (from $GOROOT)
    /home/go/go/src/github.com/gorilla/mux (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/opts.go:23:2: cannot find package "github.com/mitchellh/go-homedir" in any of:
    /usr/lib/go-1.10/src/github.com/mitchellh/go-homedir (from $GOROOT)
    /home/go/go/src/github.com/mitchellh/go-homedir (from $GOPATH)
cmd/virtual-kubelet/main.go:25:2: cannot find package "github.com/pkg/errors" in any of:
    /usr/lib/go-1.10/src/github.com/pkg/errors (from $GOROOT)
    /home/go/go/src/github.com/pkg/errors (from $GOPATH)
cmd/virtual-kubelet/main.go:26:2: cannot find package "github.com/sirupsen/logrus" in any of:
    /usr/lib/go-1.10/src/github.com/sirupsen/logrus (from $GOROOT)
    /home/go/go/src/github.com/sirupsen/logrus (from $GOPATH)
cmd/virtual-kubelet/main.go:27:2: cannot find package "github.com/spf13/cobra" in any of:
    /usr/lib/go-1.10/src/github.com/spf13/cobra (from $GOROOT)
    /home/go/go/src/github.com/spf13/cobra (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/flag.go:24:2: cannot find package "github.com/spf13/pflag" in any of:
    /usr/lib/go-1.10/src/github.com/spf13/pflag (from $GOROOT)
    /home/go/go/src/github.com/spf13/pflag (from $GOPATH)
node/api/server.go:23:2: cannot find package "go.opencensus.io/plugin/ochttp" in any of:
    /usr/lib/go-1.10/src/go.opencensus.io/plugin/ochttp (from $GOROOT)
    /home/go/go/src/go.opencensus.io/plugin/ochttp (from $GOPATH)
node/api/server.go:24:2: cannot find package "go.opencensus.io/plugin/ochttp/propagation/b3" in any of:
    /usr/lib/go-1.10/src/go.opencensus.io/plugin/ochttp/propagation/b3 (from $GOROOT)
    /home/go/go/src/go.opencensus.io/plugin/ochttp/propagation/b3 (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/tracing.go:28:2: cannot find package "go.opencensus.io/trace" in any of:
    /usr/lib/go-1.10/src/go.opencensus.io/trace (from $GOROOT)
    /home/go/go/src/go.opencensus.io/trace (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/tracing.go:29:2: cannot find package "go.opencensus.io/zpages" in any of:
    /usr/lib/go-1.10/src/go.opencensus.io/zpages (from $GOROOT)
    /home/go/go/src/go.opencensus.io/zpages (from $GOPATH)
node/node.go:25:2: cannot find package "k8s.io/api/coordination/v1beta1" in any of:
    /usr/lib/go-1.10/src/k8s.io/api/coordination/v1beta1 (from $GOROOT)
    /home/go/go/src/k8s.io/api/coordination/v1beta1 (from $GOPATH)
internal/manager/resource.go:18:2: cannot find package "k8s.io/api/core/v1" in any of:
    /usr/lib/go-1.10/src/k8s.io/api/core/v1 (from $GOROOT)
    /home/go/go/src/k8s.io/api/core/v1 (from $GOPATH)
node/env.go:24:2: cannot find package "k8s.io/apimachinery/pkg/api/errors" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/api/errors (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/api/errors (from $GOPATH)
cmd/virtual-kubelet/internal/provider/mock/mock.go:18:2: cannot find package "k8s.io/apimachinery/pkg/api/resource" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/api/resource (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/api/resource (from $GOPATH)
node/env.go:25:2: cannot find package "k8s.io/apimachinery/pkg/apis/meta/v1" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/apis/meta/v1 (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/apis/meta/v1 (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/root.go:32:2: cannot find package "k8s.io/apimachinery/pkg/fields" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/fields (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/fields (from $GOPATH)
internal/manager/resource.go:19:2: cannot find package "k8s.io/apimachinery/pkg/labels" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/labels (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/labels (from $GOPATH)
node/api/pods.go:23:2: cannot find package "k8s.io/apimachinery/pkg/runtime" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/runtime (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/runtime (from $GOPATH)
node/api/pods.go:24:2: cannot find package "k8s.io/apimachinery/pkg/runtime/serializer" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/runtime/serializer (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/runtime/serializer (from $GOPATH)
node/node.go:29:2: cannot find package "k8s.io/apimachinery/pkg/types" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/types (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/types (from $GOPATH)
node/env.go:26:2: cannot find package "k8s.io/apimachinery/pkg/util/sets" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/util/sets (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/util/sets (from $GOPATH)
node/node.go:30:2: cannot find package "k8s.io/apimachinery/pkg/util/strategicpatch" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/util/strategicpatch (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/util/strategicpatch (from $GOPATH)
node/env.go:27:2: cannot find package "k8s.io/apimachinery/pkg/util/validation" in any of:
    /usr/lib/go-1.10/src/k8s.io/apimachinery/pkg/util/validation (from $GOROOT)
    /home/go/go/src/k8s.io/apimachinery/pkg/util/validation (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/root.go:33:2: cannot find package "k8s.io/client-go/informers" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/informers (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/informers (from $GOPATH)
node/podcontroller.go:32:2: cannot find package "k8s.io/client-go/informers/core/v1" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/informers/core/v1 (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/informers/core/v1 (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/root.go:34:2: cannot find package "k8s.io/client-go/kubernetes" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/kubernetes (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/kubernetes (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/root.go:35:2: cannot find package "k8s.io/client-go/kubernetes/scheme" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/kubernetes/scheme (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/kubernetes/scheme (from $GOPATH)
node/node.go:31:2: cannot find package "k8s.io/client-go/kubernetes/typed/coordination/v1beta1" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1 (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1 (from $GOPATH)
node/node.go:32:2: cannot find package "k8s.io/client-go/kubernetes/typed/core/v1" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/kubernetes/typed/core/v1 (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/kubernetes/typed/core/v1 (from $GOPATH)
internal/manager/resource.go:20:2: cannot find package "k8s.io/client-go/listers/core/v1" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/listers/core/v1 (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/listers/core/v1 (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/root.go:38:2: cannot find package "k8s.io/client-go/rest" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/rest (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/rest (from $GOPATH)
node/pod.go:27:2: cannot find package "k8s.io/client-go/tools/cache" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/tools/cache (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/tools/cache (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/root.go:39:2: cannot find package "k8s.io/client-go/tools/clientcmd" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/tools/clientcmd (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/tools/clientcmd (from $GOPATH)
node/env.go:28:2: cannot find package "k8s.io/client-go/tools/record" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/tools/record (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/tools/record (from $GOPATH)
node/api/exec.go:28:2: cannot find package "k8s.io/client-go/tools/remotecommand" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/tools/remotecommand (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/tools/remotecommand (from $GOPATH)
node/node.go:33:2: cannot find package "k8s.io/client-go/util/retry" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/util/retry (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/util/retry (from $GOPATH)
node/pod.go:28:2: cannot find package "k8s.io/client-go/util/workqueue" in any of:
    /usr/lib/go-1.10/src/k8s.io/client-go/util/workqueue (from $GOROOT)
    /home/go/go/src/k8s.io/client-go/util/workqueue (from $GOPATH)
cmd/virtual-kubelet/internal/commands/root/flag.go:25:2: cannot find package "k8s.io/klog" in any of:
    /usr/lib/go-1.10/src/k8s.io/klog (from $GOROOT)
    /home/go/go/src/k8s.io/klog (from $GOPATH)
node/api/exec.go:29:2: cannot find package "k8s.io/kubernetes/pkg/apis/core" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/pkg/apis/core (from $GOPATH)
node/env.go:29:2: cannot find package "k8s.io/kubernetes/pkg/apis/core/pods" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core/pods (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/pkg/apis/core/pods (from $GOPATH)
node/env.go:30:2: cannot find package "k8s.io/kubernetes/pkg/apis/core/v1/helper" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/apis/core/v1/helper (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/pkg/apis/core/v1/helper (from $GOPATH)
node/env.go:31:2: cannot find package "k8s.io/kubernetes/pkg/fieldpath" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/fieldpath (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/pkg/fieldpath (from $GOPATH)
node/api/stats.go:23:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 (from $GOPATH)
node/env.go:32:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/envvars" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/envvars (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/pkg/kubelet/envvars (from $GOPATH)
node/api/exec.go:30:2: cannot find package "k8s.io/kubernetes/pkg/kubelet/server/remotecommand" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/pkg/kubelet/server/remotecommand (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/pkg/kubelet/server/remotecommand (from $GOPATH)
node/env.go:33:2: cannot find package "k8s.io/kubernetes/third_party/forked/golang/expansion" in any of:
    /usr/lib/go-1.10/src/k8s.io/kubernetes/third_party/forked/golang/expansion (from $GOROOT)
    /home/go/go/src/k8s.io/kubernetes/third_party/forked/golang/expansion (from $GOPATH)
Makefile:40: recipe for target 'build' failed
make: *** [build] Error 1

结果还是一样

相关内容