"--portal_net=10.0.0.1/24",
"--address=127.0.0.1",
"--etcd_servers=http://127.0.0.1:4001",
"--cluster_name=kubernetes",
"--v=2"
]
},
{
"name": "scheduler",
"image": "gcr.io/google_containers/hyperkube:v0.14.1",
"command": [
"/hyperkube",
"scheduler",
"--master=127.0.0.1:8080",
"--v=2"
]
}
]
}
}
This manifest is given to the kubelet, which starts the containers defined.
In this case,
it starts the API server, the scheduler, and the controller manager of Kubernetes.
These three components form a Kubernetes pod themselves and will be watched over
by the kubelet. Indeed,
if you list the running pods, you get this:
$ ./kubectl get pods
POD IP CONTAINER(S) IMAGE(S)
nginx-127 controller-manager gcr.io/google_containers/hyperkube:v0.14.1
apiserver gcr.io/google_containers/hyperkube:v0.14.1
scheduler gcr.io/google_containers/hyperkube:v0.14.1
See Also
• Running Kubernetes locally via
Docker
5.10 Compiling Kubernetes to Create Your Own Release
Problem
You want to build the Kubernetes binaries from source
instead of downloading the
released binaries.
Solution
Kubernetes is written in Go, the build system that uses Docker and builds everything
in containers. You can build Kubernetes without using containers and using your
local
Go environment, but using containers greatly simplifies the setup. Therefore, to
154 | Chapter 5: Kubernetes
build the Kubernetes binaries, you need to install
the Go language packages, Docker,
and Git to get the source code from GitHub. For instance, on an Ubuntu 14.04
system:
$ sudo apt-get update
$ sudo apt-get -y install golang
$
sudo apt-get -y install git
$ sudo curl -sSL https://get.docker.com/ | sudo sh
Verify that you have Go and Docker installed:
$ go version
go version go1.2.1 linux/amd64
$ docker version
Client version: 1.6.1
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 97cd073
OS/Arch (client): linux/amd64
Server version: 1.6.1
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 97cd073
OS/Arch (server): linux/amd64
Clone the Kubernetes Git repo to get the Go source code:
$ git clone https://github.com/GoogleCloudPlatform/kubernetes.git
$ cd kubernetes
You are now ready to build the binaries.
A build script,
run.sh
, is provided in the
/
build
directory; just use it. It will ask whether you want to download the Docker
image for Golang, then start the build. Here is a snippet of a build run:
$ ./build/run.sh hack/build-go.sh
+++ [0513 11:51:46] Verifying Prerequisites....
You don't have a local copy of the golang docker image. This image is 450MB.
Download it now? [y/n] Y
...
+++ [0513 11:58:08] Placing binaries
+++ [0513 11:58:14] Running build command....
+++ [0513 11:58:16] Output directory is local. No need to copy results out.
The binaries will be in the
_output
directory. If you built on a Linux 64-bit host, they
will be in
_output/dockerized/bin/linux/amd64
:
~/kubernetes/_output/dockerized/bin/linux/amd64# tree
.
├── e2e
├── genbashcomp
├── gendocs
├── genman
├── ginkgo
├── hyperkube
Do'stlaringiz bilan baham: