k8s 集羣部署是個老生常談的問題,網上資料一大把,各路大神祭出了各類方案:node
本文介紹在 瀏覽 k8s 源代碼過程當中發現的 k8s 的一種半手工的部署方法linux
瀏覽源代碼的過程當中發現有這麼個目錄git
# /opt/kubernetes-src/src/k8s.io/cluster/centos drwxrwxr-x 4 xingpingz xingpingz 4096 12月 4 13:31 ./ drwxrwxr-x 21 xingpingz xingpingz 4096 12月 4 13:31 ../ -rwxrwxr-x 1 xingpingz xingpingz 4305 12月 4 11:37 build.sh* -rwxrwxr-x 1 xingpingz xingpingz 1763 12月 4 11:40 config-build.sh* -rwxrwxr-x 1 xingpingz xingpingz 4899 12月 4 13:31 config-default.sh* -rw-rw-r-- 1 xingpingz xingpingz 747 12月 4 11:37 config-test.sh -rwxrwxr-x 1 xingpingz xingpingz 2739 12月 4 11:40 deployAddons.sh* -rw-rw-r-- 1 xingpingz xingpingz 175 12月 4 11:37 .gitignore drwxrwxr-x 3 xingpingz xingpingz 4096 12月 4 11:37 master/ drwxrwxr-x 4 xingpingz xingpingz 4096 12月 4 11:37 node/ -rwxrwxr-x 1 xingpingz xingpingz 12319 12月 4 11:37 util.sh*
一看就知道這些 shell 腳本應該是用於在 centos 中自動下載,安裝 k8s 的github
查看一下配置文件 config-build.sh,這裏能夠配置要下載的 k8s 各個組件的版本docker
RELEASES_DIR=${RELEASES_DIR:-/tmp/downloads} # Define docker version to use. DOCKER_VERSION=${DOCKER_VERSION:-"1.12.1"} # Define flannel version to use. FLANNEL_VERSION=${FLANNEL_VERSION:-"0.6.1"} # Define etcd version to use. ETCD_VERSION=${ETCD_VERSION:-"3.0.9"} # Define k8s version to use. K8S_VERSION=${K8S_VERSION:-"1.3.7"} DOCKER_DOWNLOAD_URL=\ "https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz" FLANNEL_DOWNLOAD_URL=\ "https://github.com/coreos/flannel/releases/download/v${FLANNEL_VERSION}/flannel-v${FLANNEL_VERSION}-linux-amd64.tar.gz" ETCD_DOWNLOAD_URL=\ "https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz" # TODO(#33726): switch to dl.k8s.io K8S_CLIENT_DOWNLOAD_URL=\ "https://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/kubernetes-client-linux-amd64.tar.gz" K8S_SERVER_DOWNLOAD_URL=\ "https://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/kubernetes-server-linux-amd64.tar.gz"
從 github 上下載的組件還好說,可是從 storage.googleapis.com 拉東西下來估計夠嗆shell
不少時候答案就隱藏在源代碼中,與其滿世界搜索,不如靜下心來在 源碼 或 文檔中到答案~centos