building kubernetes on Docker

5/22/2018

OS: CentOS 7 docker version 1.13.1

I am trying to install kubernetes on centos to run in-house. I built it using the build on docker since the build with go would not work. Documentation is extremely poor regarding dependencies and specifics.

I followed the instructions on the kubernetes site here : https://github.com/kubernetes/kubernetes

[kubernetes]$ git clone https://github.com/kubernetes/kubernetes
[kubernetes]$ cd kubernetes
[kubernetes]$ make quick-release
+++ [0521 22:31:10] Verifying Prerequisites....
+++ [0521 22:31:17] Building Docker image kube-build:build-e7afc7a916-5-v1.10.2-1
+++ [0521 22:33:45] Creating data container kube-build-data-e7afc7a916-5-v1.10.2-1
+++ [0521 22:34:57] Syncing sources to container
+++ [0521 22:35:15] Running build command...
+++ [0521 22:36:02] Building go targets for linux/amd64:
    ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
+++ [0521 22:36:14] Building go targets for linux/amd64:
    ./vendor/k8s.io/code-generator/cmd/defaulter-gen
+++ [0521 22:36:21] Building go targets for linux/amd64:
    ./vendor/k8s.io/code-generator/cmd/conversion-gen
+++ [0521 22:36:31] Building go targets for linux/amd64:
    ./vendor/k8s.io/code-generator/cmd/openapi-gen
+++ [0521 22:36:40] Building go targets for linux/amd64:
    ./vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0521 22:36:42] 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
    cmd/kube-scheduler
    vendor/k8s.io/kube-aggregator
    vendor/k8s.io/apiextensions-apiserver
    cluster/gce/gci/mounter
+++ [0521 22:40:24] Building go targets for linux/amd64:
    cmd/kube-proxy
    cmd/kubeadm
    cmd/kubelet
+++ [0521 22:41:08] Building go targets for linux/amd64:
    cmd/kubectl
+++ [0521 22:41:31] Building go targets for linux/amd64:
    cmd/gendocs
    cmd/genkubedocs
    cmd/genman
    cmd/genyaml
    cmd/genswaggertypedocs
    cmd/linkcheck
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e/e2e.test
+++ [0521 22:44:24] Building go targets for linux/amd64:
    cmd/kubemark
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e_node/e2e_node.test
+++ [0521 22:45:24] Syncing out of container
+++ [0521 22:46:39] Building tarball: src
+++ [0521 22:46:39] Building tarball: manifests
+++ [0521 22:46:39] Starting tarball: client darwin-386
+++ [0521 22:46:39] Starting tarball: client darwin-amd64
+++ [0521 22:46:39] Starting tarball: client linux-386
+++ [0521 22:46:39] Starting tarball: client linux-amd64
+++ [0521 22:46:39] Starting tarball: client linux-arm
+++ [0521 22:46:39] Starting tarball: client linux-arm64
+++ [0521 22:46:39] Starting tarball: client linux-ppc64le
+++ [0521 22:46:39] Starting tarball: client linux-s390x
+++ [0521 22:46:39] Starting tarball: client windows-386
+++ [0521 22:46:39] Starting tarball: client windows-amd64
+++ [0521 22:46:39] Waiting on tarballs
+++ [0521 22:47:19] Building tarball: server linux-amd64
+++ [0521 22:47:19] Building tarball: node linux-amd64
+++ [0521 22:47:47] Starting docker build for image: cloud-controller-manager-amd64
+++ [0521 22:47:47] Starting docker build for image: kube-apiserver-amd64
+++ [0521 22:47:47] Starting docker build for image: kube-controller-manager-amd64
+++ [0521 22:47:47] Starting docker build for image: kube-scheduler-amd64
+++ [0521 22:47:47] Starting docker build for image: kube-aggregator-amd64
+++ [0521 22:47:47] Starting docker build for image: kube-proxy-amd64
+++ [0521 22:47:47] Building hyperkube image for arch: amd64
+++ [0521 22:48:31] Deleting docker image k8s.gcr.io/kube-scheduler:v1.12.0-alpha.0.143_080739a12a25bc
+++ [0521 22:48:31] Deleting docker image k8s.gcr.io/kube-aggregator:v1.12.0-alpha.0.143_080739a12a25bc
+++ [0521 22:48:41] Deleting docker image k8s.gcr.io/kube-controller-manager:v1.12.0-alpha.0.143_080739a12a25bc
+++ [0521 22:48:43] Deleting docker image k8s.gcr.io/cloud-controller-manager:v1.12.0-alpha.0.143_080739a12a25bc
+++ [0521 22:48:46] Deleting docker image k8s.gcr.io/kube-apiserver:v1.12.0-alpha.0.143_080739a12a25bc
+++ [0521 22:48:58] Deleting docker image k8s.gcr.io/kube-proxy:v1.12.0-alpha.0.143_080739a12a25bc
+++ [0521 22:49:36] Deleting hyperkube image k8s.gcr.io/hyperkube-amd64:v1.12.0-alpha.0.143_080739a12a25bc
+++ [0521 22:49:36] Docker builds done
+++ [0521 22:50:54] Building tarball: final
+++ [0521 22:50:54] Building tarball: test
  1. my first question is, why at the end of the build, does docker delete the kube-apiserver, kube-proxy, etc.. These are the tools I was expecting to use.

  2. second question, why do I now just have a 'kube-build' image. How do I interact with this? I was expecting to see kubeadm and kubectl in addition to the kube build.
    The documentation says nothing else about what to do next. How to create the a pod, deploy a container, and manage it. I was expecting to do this with docker attach on the kubectl/kubeadm images, but there are none.

    $ docker images
    REPOSITORY                               TAG                            IMAGE ID            CREATED             SIZE
    kube-build                               build-e7afc7a916-5-v1.10.2-1   8d27a8ba87fd        About an hour ago   2.58 GB
    docker.io/node                           latest                         f697cb5f31f8        12 days ago         675 MB
    docker.io/redis                          latest                         bfcb1f6df2db        2 weeks ago         107 MB
    docker.io/mongo                          latest                         14c497d5c758        3 weeks ago         366 MB
    docker.io/nginx                          latest                         ae513a47849c        3 weeks ago         109 MB

So what exactly is someone supposed to do with the 'kube-build' image. Any help would be great. thanks!

Additionally, I tried to tag this 'kube-build' since that is the exact image name, but I don't have enough reputation to make a new tag.

-- Aaron
docker
kubernetes

1 Answer

5/25/2018

First of all, the result of built is located in folder _output :

[@_output]# ls
dockerized  images  release-images  release-stage  release-tars

In folder release-images\$your_architecture, you can find the images in tarballs:

[@release-images]# cd amd64/
[@amd64]# ls
cloud-controller-manager.tar  hyperkube-amd64.tar  kube-aggregator.tar  kube-apiserver.tar  kube-controller-manager.tar  kube-proxy.tar  kube-scheduler.tar

You can import them to you local docker repo with the following command:

cat kube-apiserver.tar | docker import - kube-api:new

The result you will find in the local docker image repo :

[@amd64]# docker images
REPOSITORY                                 TAG                            IMAGE ID            CREATED             SIZE
kube-api                                   new                            4bd734072676        7 minutes ago       183MB

You can also find tarballs with binaries in folder release-tars.

Usually, Kubernetes was built on one server and then used on another, that's why you have folder _output with the results of you build.

-- Nick Rak
Source: StackOverflow