Kubernetes源码编译
目前有2种方向, 一种是直接使用golang来编译出二进制包, 另外一种是通过容器来编译.前提当然是本地需要下载k8s源码Golang编译直接编译也可以分成2种,一种是一次编译出来, 一种是每个模块单独编译全编译这种方法比较简单, 进入源码目录直接执行make命令即可, 不过对应的k8s版本, 对go语言版本有一些要求, 具体可看k8s网站或者直接编译会提示需要哪个版本go语言...
·
目前有2种方向, 一种是直接使用golang来编译出二进制包, 另外一种是通过容器来编译.
前提当然是本地需要下载k8s源码
Golang编译
直接编译也可以分成2种,一种是一次编译出来, 一种是每个模块单独编译
全编译
这种方法比较简单, 进入源码目录直接执行make
命令即可, 不过对应的k8s版本, 对go语言版本有一些要求, 具体可看k8s网站或者直接编译会提示需要哪个版本go语言.
编译会显示如下信息
[root@SZD-L0113231 kubernetes-release-1.9]# make
+++ [0830 08:50:54] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0830 08:50:54] Generating bindata:
test/e2e/generated/gobindata_util.go
/home/czs/code/kubernetes-release-1.9 /home/czs/code/kubernetes-release-1.9/test/e2e/generated
/home/czs/code/kubernetes-release-1.9/test/e2e/generated
+++ [0830 08:50:55] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/deepcopy-gen
+++ [0830 08:51:02] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0830 08:51:02] Generating bindata:
test/e2e/generated/gobindata_util.go
/home/czs/code/kubernetes-release-1.9 /home/czs/code/kubernetes-release-1.9/test/e2e/generated
/home/czs/code/kubernetes-release-1.9/test/e2e/generated
+++ [0830 08:51:03] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/defaulter-gen
+++ [0830 08:51:08] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0830 08:51:08] Generating bindata:
test/e2e/generated/gobindata_util.go
/home/czs/code/kubernetes-release-1.9 /home/czs/code/kubernetes-release-1.9/test/e2e/generated
/home/czs/code/kubernetes-release-1.9/test/e2e/generated
+++ [0830 08:51:09] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/conversion-gen
+++ [0830 08:51:14] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0830 08:51:14] Generating bindata:
test/e2e/generated/gobindata_util.go
/home/czs/code/kubernetes-release-1.9 /home/czs/code/kubernetes-release-1.9/test/e2e/generated
/home/czs/code/kubernetes-release-1.9/test/e2e/generated
+++ [0830 08:51:15] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/openapi-gen
+++ [0830 08:51:21] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0830 08:51:21] Generating bindata:
test/e2e/generated/gobindata_util.go
/home/czs/code/kubernetes-release-1.9 /home/czs/code/kubernetes-release-1.9/test/e2e/generated
/home/czs/code/kubernetes-release-1.9/test/e2e/generated
+++ [0830 08:51:21] Building go targets for linux/amd64:
cmd/kube-proxy
cmd/kube-apiserver
cmd/kube-controller-manager
cmd/cloud-controller-manager
cmd/kubelet
cmd/kubeadm
cmd/hyperkube
vendor/k8s.io/kube-aggregator
vendor/k8s.io/apiextensions-apiserver
plugin/cmd/kube-scheduler
cluster/gce/gci/mounter
cmd/kubectl
cmd/gendocs
cmd/genkubedocs
cmd/genman
cmd/genyaml
cmd/genswaggertypedocs
cmd/linkcheck
vendor/github.com/onsi/ginkgo/ginkgo
test/e2e/e2e.test
cmd/kubemark
vendor/github.com/onsi/ginkgo/ginkgo
test/e2e_node/e2e_node.test
cmd/gke-certificates-controller
最后在 _output
里面生成二进制文件
更多推荐
已为社区贡献4条内容
所有评论(0)