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
這個問題應(yīng)該是由于代理沒有設(shè)置好的緣故味咳∶撇妫可是我設(shè)置了兩處代理擦俐,都還是不行
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
原來還要設(shè)置docker的代理.
ubuntu: /etc/defautl/docker
export http_proxy="http://usrname:pswd@proxy.com:port"
export https_proxy="https://usrname:pswd@proxy.com:port"
接著就會出現(xiàn)另一個問題:
~/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中添加參數(shù)--insecure-registry gcr.io
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry gcr.io"
配置這些參數(shù)都需要重啟
sudo service docker restart
或者
sudo service docker stop # to stop the service
sudo docker -d --insecure-registry gcr.io
-
問題2
用git命令下載kubernetes代碼時,有可能出現(xiàn)如下錯誤:
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
下載完之后 運(yùn)行/kubernetes/build下的release.sh 如果是非root用戶有可能出現(xiàn)如下錯誤:
can't connect to docker daemon握侧。
解決方案是:
在執(zhí)行release.sh命令前加上sudo
sudo ./relese.sh -
問題4
如果執(zhí)行kube-up.sh后蚯瞧,驗證某個minion失敗,報錯為minion節(jié)點的docker運(yùn)行失敗品擎,則檢查master和minion節(jié)點是否支持brctl命令埋合,如果沒有安裝,執(zhí)行如下命令進(jìn)行安裝孽查。安裝完后重新執(zhí)行kube-up.sh,問題解決饥悴。
apt-get install bridge-utils -
問題5
可能的原因是8080端口被占用,把占用8080端口的進(jìn)程殺掉盲再,問題解決西设。具體查看方式依照如下博客所述:
https://github.com/kubernetes/kubernetes/issues/11893
官方guide
** 要求 **
- Docker
Mac OS X:可以使用docker-machine或者boot2docker.
Note: 設(shè)置 boot2docker vm 至少有3GB的初始內(nèi)存,否則會失敗 (See:#11852)答朋;不要從/tmp/中make quick-release贷揽。 (See: #14773)
Linux with local Docker:instructions - Python
- Google Cloud SDK (可選)
** 腳本 **
-
run.sh
: 在一個build docker容器中執(zhí)行指令-
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.
自動下載并建立一個默認(rèn)的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