1、环境介绍

编译机器为OpenStack Train部署的一个虚拟机
虚拟机镜像版本为:

# cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)

2、安装依赖包

需要安装docker和rsync

2.1、配置repo

参考
https://blog.csdn.net/weixin_43905458/article/details/103629308

2.2、安装docker和rsync

yum install -y docker
yum install -y rsync

其中rsync包需要安装,不然会报如下错误

# make quick-release
+++ [0106 10:08:35] Verifying Prerequisites....
which: no rsync in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
!!! [0106 10:08:35] Can't find 'rsync' in PATH, please fix and retry.
make: *** [quick-release] Error 1

3、下载编译镜像

3.1、配置私有镜像仓库

192.168.166.187:5000为基于registry镜像搭建的镜像仓库

# cat /etc/docker/daemon.json
{
    "insecure-registries":["192.168.166.187:5000"]
}

3.2、下载编译镜像

pull编译镜像

docker pull 192.168.166.187:5000/kube-cross:v1.13.4-1
docker pull 192.168.166.187:5000/debian-base-amd64:v2.0.0
docker pull 192.168.166.187:5000/debian-iptables-amd64:v12.0.1

给编译镜像打标签

docker tag 192.168.166.187:5000/kube-cross:v1.13.4-1 k8s.gcr.io/kube-cross:v1.13.4-1
docker tag 192.168.166.187:5000/debian-base-amd64:v2.0.0 k8s.gcr.io/debian-base-amd64:v2.0.0
docker tag 192.168.166.187:5000/debian-iptables-amd64:v12.0.1 k8s.gcr.io/debian-iptables-amd64:v12.0.1

4、下载k8s v1.17.0源代码

wget https://codeload.github.com/kubernetes/kubernetes/tar.gz/v1.17.0 .
tar zxvf v1.17.0
cd kubernetes-1.17.0/

5、编译k8s版本

KUBE_BASE_IMAGE_REGISTRY="192.168.166.187:5000" KUBE_DOCKER_REGISTRY="192.168.166.187:5000"  KUBE_BUILD_CONFORMANCE=n KUBE_BUILD_HYPERKUBE=n make quick-release

编译后版本路径

ls -l _output/release-images/amd64/
total 644528
-rw-------. 2 root root 213712896 Jan  8 04:37 kube-apiserver.tar
-rw-------. 2 root root 202202112 Jan  8 04:37 kube-controller-manager.tar
-rw-------. 2 root root 132126208 Jan  8 04:37 kube-proxy.tar
-rw-------. 2 root root 111948288 Jan  8 04:37 kube-scheduler.tar
ls -l _output/release-tars/
total 1074160
-rw-r--r--. 1 root root  23144539 Jan  8 04:36 kubernetes-client-linux-amd64.tar.gz
-rw-r--r--. 1 root root     77571 Jan  8 04:36 kubernetes-manifests.tar.gz
-rw-r--r--. 1 root root 144675575 Jan  8 04:37 kubernetes-node-linux-amd64.tar.gz
-rw-r--r--. 1 root root 537029957 Jan  8 04:39 kubernetes-server-linux-amd64.tar.gz
-rw-r--r--. 1 root root  31985693 Jan  8 04:36 kubernetes-src.tar.gz
-rw-r--r--. 1 root root    450156 Jan  8 04:39 kubernetes.tar.gz
-rw-r--r--. 1 root root 362360006 Jan  8 04:40 kubernetes-test-linux-amd64.tar.gz
-rw-r--r--. 1 root root    203034 Jan  8 04:40 kubernetes-test-portable.tar.gz

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐