download
在ubuntu上直接git clone https://github.com/kubernetes/kubernetes.git
就可以了。
由于防火墙等未知因素,git clone老是失败,最终采用直接在github,下载zip包,然后解压build
cd kubernetes
make release
如果你是小白的话,build的过程会让你安装docker
docker的安装请参见Install-
问题 1
$ make release
+++ [0728 15:46:56] Verifying Prerequisites....
+++ [0728 15:47:05] Building Docker image kube-build:build-cf5c558a5d
+++ Docker build command failed for kube-build:build-cf5c558a5dSending build context to Docker daemon 33.26 MB Step 1 : FROM gcr.io/google_containers/kube-cross:v1.6.3-0 Get https://gcr.io/v1/_ping: dial tcp: i/o timeout To retry manually, run: docker build -t kube-build:build-cf5c558a5d --pull=false /usr1/s00295316/kubernetes-master/_output/images/kube-build:build-cf5c558a5d !!! Error in build/../build/common.sh:535 'return 1' exited with status 1 Call stack: 1: build/../build/common.sh:535 kube::build::build_image(...) 2: build/release.sh:32 main(...) Exiting with status 1 make: *** [release] Error 1
这个问题应该是由于代理没有设置好的缘故。可是我设置了两处代理,都还是不行
export http_proxy=http://usrname:pswd@proxy.com:port
export https_proxy=https://usrname:pswd@proxy.com:port
export ftp_proxy=ftp://usrname:pswd@proxy.com:port
export all_proxy=http://usrname:pswd@proxy.com:port
添加
export KUBERNETES_HTTPS_PROXY=https://usrname:pswd@proxy.com:port
export KUBERNETES_HTTP_PROXY=http://usrname:pswd@proxy.com:port
原来还要设置docker的代理.
ubuntu: /etc/defautl/docker
export http_proxy="http://usrname:pswd@proxy.com:port"
export https_proxy="https://usrname:pswd@proxy.com:port"
接着就会出现另一个问题:
~/kubernetes-master$ docker build -t kube-build:build-cf5c558a5d --pull=false /usr1/s00295316/kubernetes-master/_output/images/kube-build:build-cf5c558a5d Sending build context to Docker daemon 140.8 MB Step 1 : FROM gcr.io/google_containers/kube-cross:v1.6.3-0 Get https://gcr.io/v1/_ping: x509: certificate signed by unknown authority
需要在demon中添加参数--insecure-registry gcr.io
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry gcr.io"
配置这些参数都需要重启
sudo service docker restart
或者
sudo service docker stop # to stop the service
sudo docker -d --insecure-registry gcr.io
-
问题2
用git命令下载kubernetes代码时,有可能出现如下错误:
unable to access 'https://github.com/kubernetes/kubernetes.git/': Failed connect to github.com:443;
解决方案是:
git config --global http.proxy http://username:psw@proxyhk.huawei.com:8080 -
问题3
下载完之后 运行/kubernetes/build下的release.sh 如果是非root用户有可能出现如下错误:
can't connect to docker daemon。
解决方案是:
在执行release.sh命令前加上sudo
sudo ./relese.sh -
问题4
如果执行kube-up.sh后,验证某个minion失败,报错为minion节点的docker运行失败,则检查master和minion节点是否支持brctl命令,如果没有安装,执行如下命令进行安装。安装完后重新执行kube-up.sh,问题解决。
apt-get install bridge-utils -
问题5
可能的原因是8080端口被占用,把占用8080端口的进程杀掉,问题解决。具体查看方式依照如下博客所述:
https://github.com/kubernetes/kubernetes/issues/11893
官方guide
** 要求 **
- Docker
Mac OS X:可以使用docker-machine或者boot2docker.
Note: 设置 boot2docker vm 至少有3GB的初始内存,否则会失败 (See:#11852);不要从/tmp/中make quick-release。 (See: #14773)
Linux with local Docker:instructions - Python
- Google Cloud SDK (可选)
** 脚本 **
-
run.sh
: 在一个build docker容器中执行指令-
run.sh make
: Build just linux binaries in the container. Pass options and packages as necessary. -
run.sh make cross
: Build all binaries for all platforms -
run.sh make test
: Run all unit tests -
run.sh make test-integration
: Run integration test -
run.sh make test-cmd
: Run CLI tests
-
-
copy-output.sh
: This will copy the contents of_output/dockerized/bin
from any remote Docker container to the local_output/dockerized/bin
. Right now this is only necessary on Mac OS X withboot2docker
when your git repo isn't under/Users
. -
make-clean.sh
: Clean out the contents of_output/dockerized
and remove any local built container images. -
shell.sh
: Drop into abash
shell in a build container with a snapshot of the current repo code. -
release.sh
: Build everything, test it, and (optionally) upload the results to a GCS bucket.
自动下载并建立一个默认的cluster
# wget version
export KUBERNETES_PROVIDER=YOUR_PROVIDER; wget -q -O - https://get.k8s.io | bash
# curl version
export KUBERNETES_PROVIDER=YOUR_PROVIDER; curl -sS https://get.k8s.io | bash