root@ubuntu:~/kubernetes-operator# source ~/kata/go_source root@ubuntu:~/kubernetes-operator# make images mkdir -p output GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/ GOOS=linux GOARCH=amd64 go build -ldflags "" -o output/ansibleinit cmd/installer/ssh/ansibleinit.go go: finding module for package k8s.io/client-go/rest go: downloading github.com/spf13/viper v1.4.0 go: downloading k8s.io/apimachinery v0.0.0-20190717022731-0bb8574e0887 go: downloading github.com/fsnotify/fsnotify v1.4.7 go: downloading github.com/hashicorp/hcl v1.0.0 go: downloading github.com/mitchellh/mapstructure v1.1.2 go: downloading github.com/pelletier/go-toml v1.2.0 go: downloading github.com/spf13/jwalterweatherman v1.0.0 go: downloading github.com/magiconair/properties v1.8.0 go: downloading github.com/spf13/cast v1.3.0 go: downloading golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f go: downloading github.com/spf13/afero v1.1.2 go: downloading k8s.io/klog v0.3.1 go: downloading github.com/gogo/protobuf v1.2.1 go: downloading github.com/json-iterator/go v1.1.6 go: downloading gopkg.in/yaml.v2 v2.2.2 go: downloading golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 cmd/installer/ssh/ansibleinit.go:39:2: module k8s.io/client-go@latest found (v1.5.2), but does not contain package k8s.io/client-go/rest Makefile:24: recipe for target ‘images‘ failed make: *** [images] Error 1 root@ubuntu:~/kubernetes-operator# ls ansible build cmd configs deploy doc go.mod go.sum images LICENSE main.go Makefile output pkg README.md scripts test root@ubuntu:~/kubernetes-operator# grep client-go go.mod root@ubuntu:~/kubernetes-operator# grep client-go go.sum k8s.io/client-go v1.5.2 h1:JOxmv4FxrCIOS54kAABbN8/hA9jqGpns+Zc6soNgd8U= root@ubuntu:~/kubernetes-operator# make images mkdir -p output GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/ GOOS=linux GOARCH=amd64 go build -ldflags "" -o output/ansibleinit cmd/installer/ssh/ansibleinit.go go: finding module for package k8s.io/client-go/rest cmd/installer/ssh/ansibleinit.go:39:2: module k8s.io/client-go@latest found (v1.5.2), but does not contain package k8s.io/client-go/rest Makefile:24: recipe for target ‘images‘ failed make: *** [images] Error 1 root@ubuntu:~/kubernetes-operator# go get k8s.io/client-go/rest go get k8s.io/client-go/rest: module k8s.io/client-go@upgrade found (v1.5.2), but does not contain package k8s.io/client-go/rest
root@ubuntu:~/kubernetes-operator# go mod edit -require="k8s.io/client-go@kubernetes-1.16.1" root@ubuntu:~/kubernetes-operator# go clean --modcache root@ubuntu:~/kubernetes-operator# make images mkdir -p output GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/ GOOS=linux GOARCH=arm64 go build -ldflags "" -o output/ansibleinit cmd/installer/ssh/ansibleinit.go
一、下载go-client包
1 $ go get -u -v k8s.io/client-go/... 因
为了确认下载的确在进行,加上了-u和-v,可以看见具体下载的过程。 下载完成后,
对照官方GitHub中go-client和执行下面的操作:
cd $GOPATH/src/k8s.io/client-go $ git checkout v9.0.0 #这里要根据版本对照表,找出和自己的Kubernetes集群对应的版本