K8s: Building a Binary installation package from source code

Source: Internet
Author: User
Tags docker hub k8s
This is a creation in Article, where the information may have evolved or changed.

Objective

This article describes how to build a k8s binary installation package from source code

Preparatory work

Operating system cenos7.x

Installing Docker

Reference website or online tutorials

Download source code

$ cd /opt/$ git clone https://github.com/kubernetes/kubernetes.git

Checkout

$ cd/opt/kubernetes
$ git checkout v1.8.4-b v1.8.4

Preparing the base Docker image

If you build it directly, you will find that the card will not move, because the build script will pull from GCR (Google container registry) to build the required base image, and is forced to pull ..., if there is no VPN, it is tragic. There are two ways of doing this:

    • Pull someone else's uploaded image from the Docker Hub and tag it locally
    • Build a base image from Kubernetes source code

Here are only methods 2

$ docker pull mirrorgooglecontainers/kube-cross:v1.8.3-2$ docker tag mirrorgooglecontainers/kube-cross:v1.8.3-2 gcr.io/google_containers/kube-cross:v1.8.3-2$ docker pull mirrorgooglecontainers/debian-iptables-amd64:v8$ docker tag mirrorgooglecontainers/debian-iptables-amd64:v8 gcr.io/google_containers/debian-iptables-amd64:v8

Modify Build/lib/release.sh

Remove the--pull option from the Docker build command, or pull the mirror from GCR ...

index 3134e4d..e1881b4 100644--- a/build/lib/release.sh+++ b/build/lib/release.sh@@ -323,7 +323,7 @@ function kube::release::create_docker_images_for_server() {         ln ${binary_dir}/${binary_name} ${docker_build_path}/${binary_name}         printf " FROM ${base_image} \n ADD ${binary_name} /usr/local/bin/${binary_name}\n" > ${docker_file_path} -        "${DOCKER[@]}" build --pull -q -t "${docker_image_tag}" ${docker_build_path} >/dev/null+        "${DOCKER[@]}" build -q -t "${docker_image_tag}" ${docker_build_path} >/dev/null         "${DOCKER[@]}" save "${docker_image_tag}" > "${binary_dir}/${binary_name}.tar"         echo "${docker_tag}" > ${binary_dir}/${binary_name}.docker_tag         rm -rf ${docker_build_path}

Build

cd /opt/kubernetesmake quick-release

Note: Quick-release builds only the current system version (for example, LINUX-AMD64)

After the build is complete, the k8s binary installation package is generated in the/opt/kubernetes/_output/release-tarts directory:

kubernetes-client-linux-amd64.tar.gz(客户端命令行工具)kubernetes-server-linux-amd64.tar.gz(master 和 node 节点 k8s 服务程序)kubernetes-src.tar.gz(k8s 源代码包)kubernetes.tar.gz(master 和 node 节点 k8s 基础包)

Summarize

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.