Downloading or Building Kubernetes

  • 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-cf5c558a5d

    Sending 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

** 要求 **

  1. Docker
    Mac OS X:可以使用docker-machine或者boot2docker.
    Note: 设置 boot2docker vm 至少有3GB的初始内存,否则会失败 (See:#11852);不要从/tmp/中make quick-release。 (See: #14773)
    Linux with local Dockerinstructions
  2. Python
  3. 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 with boot2docker 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 a bash 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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,080评论 19 139
  • 安装k8s Master高可用集群 主机 角色 组件 172.18.6.101 K8S Master Kubele...
    jony456123阅读 8,105评论 0 9
  • 今天是2016年12月15日 2016年已经接近尾声了,对于每个流浪在外的人来说,可能回家的日子又近了,或许对于我...
    吕桑榆阅读 393评论 0 2
  • 每次回老家第一顿准是面条,离开家临走时准是饺子,意思是:来了客人用长面条拦拦,欢迎多多来此。送行饺子意味着照顾不周...
    菩提向东阅读 340评论 0 0
  • 亲爱的小伙伴们,欢迎大家一起来参加中国软实力总裁班和翻译班培训,以下是活动的相关信息,帮助大家更好的参与到...
    未来金刚研究院阅读 1,122评论 0 0