configure.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. #!/usr/bin/env bash
  2. # Copyright 2016 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Due to the GCE custom metadata size limit, we split the entire script into two
  16. # files configure.sh and configure-helper.sh. The functionality of downloading
  17. # kubernetes configuration, manifests, docker images, and binary files are
  18. # put in configure.sh, which is uploaded via GCE custom metadata.
  19. set -o errexit
  20. set -o nounset
  21. set -o pipefail
  22. ### Hardcoded constants
  23. DEFAULT_CNI_VERSION="v0.7.5"
  24. DEFAULT_CNI_SHA1="52e9d2de8a5f927307d9397308735658ee44ab8d"
  25. DEFAULT_NPD_VERSION="v0.6.3"
  26. DEFAULT_NPD_SHA1="3a6ac56be6c121f1b94450bfd1a81ad28d532369"
  27. DEFAULT_CRICTL_VERSION="v1.14.0"
  28. DEFAULT_CRICTL_SHA1="1f93c6183d0a4e186708efe7899da7a7bce9c736"
  29. DEFAULT_MOUNTER_TAR_SHA="8003b798cf33c7f91320cd6ee5cec4fa22244571"
  30. ###
  31. # Use --retry-connrefused opt only if it's supported by curl.
  32. CURL_RETRY_CONNREFUSED=""
  33. if curl --help | grep -q -- '--retry-connrefused'; then
  34. CURL_RETRY_CONNREFUSED='--retry-connrefused'
  35. fi
  36. function set-broken-motd {
  37. cat > /etc/motd <<EOF
  38. Broken (or in progress) Kubernetes node setup! Check the cluster initialization status
  39. using the following commands.
  40. Master instance:
  41. - sudo systemctl status kube-master-installation
  42. - sudo systemctl status kube-master-configuration
  43. Node instance:
  44. - sudo systemctl status kube-node-installation
  45. - sudo systemctl status kube-node-configuration
  46. EOF
  47. }
  48. function download-kube-env {
  49. # Fetch kube-env from GCE metadata server.
  50. (
  51. umask 077
  52. local -r tmp_kube_env="/tmp/kube-env.yaml"
  53. curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error \
  54. -H "X-Google-Metadata-Request: True" \
  55. -o "${tmp_kube_env}" \
  56. http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-env
  57. # Convert the yaml format file into a shell-style file.
  58. eval $(python -c '''
  59. import pipes,sys,yaml
  60. for k,v in yaml.load(sys.stdin).iteritems():
  61. print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
  62. ''' < "${tmp_kube_env}" > "${KUBE_HOME}/kube-env")
  63. rm -f "${tmp_kube_env}"
  64. )
  65. }
  66. function download-kubelet-config {
  67. local -r dest="$1"
  68. echo "Downloading Kubelet config file, if it exists"
  69. # Fetch kubelet config file from GCE metadata server.
  70. (
  71. umask 077
  72. local -r tmp_kubelet_config="/tmp/kubelet-config.yaml"
  73. if curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error \
  74. -H "X-Google-Metadata-Request: True" \
  75. -o "${tmp_kubelet_config}" \
  76. http://metadata.google.internal/computeMetadata/v1/instance/attributes/kubelet-config; then
  77. # only write to the final location if curl succeeds
  78. mv "${tmp_kubelet_config}" "${dest}"
  79. elif [[ "${REQUIRE_METADATA_KUBELET_CONFIG_FILE:-false}" == "true" ]]; then
  80. echo "== Failed to download required Kubelet config file from metadata server =="
  81. exit 1
  82. fi
  83. )
  84. }
  85. function download-kube-master-certs {
  86. # Fetch kube-env from GCE metadata server.
  87. (
  88. umask 077
  89. local -r tmp_kube_master_certs="/tmp/kube-master-certs.yaml"
  90. curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error \
  91. -H "X-Google-Metadata-Request: True" \
  92. -o "${tmp_kube_master_certs}" \
  93. http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-master-certs
  94. # Convert the yaml format file into a shell-style file.
  95. eval $(python -c '''
  96. import pipes,sys,yaml
  97. for k,v in yaml.load(sys.stdin).iteritems():
  98. print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
  99. ''' < "${tmp_kube_master_certs}" > "${KUBE_HOME}/kube-master-certs")
  100. rm -f "${tmp_kube_master_certs}"
  101. )
  102. }
  103. function validate-hash {
  104. local -r file="$1"
  105. local -r expected="$2"
  106. actual=$(sha1sum ${file} | awk '{ print $1 }') || true
  107. if [[ "${actual}" != "${expected}" ]]; then
  108. echo "== ${file} corrupted, sha1 ${actual} doesn't match expected ${expected} =="
  109. return 1
  110. fi
  111. }
  112. # Get default service account credentials of the VM.
  113. GCE_METADATA_INTERNAL="http://metadata.google.internal/computeMetadata/v1/instance"
  114. function get-credentials {
  115. curl "${GCE_METADATA_INTERNAL}/service-accounts/default/token" -H "Metadata-Flavor: Google" -s | python -c \
  116. 'import sys; import json; print(json.loads(sys.stdin.read())["access_token"])'
  117. }
  118. function valid-storage-scope {
  119. curl "${GCE_METADATA_INTERNAL}/service-accounts/default/scopes" -H "Metadata-Flavor: Google" -s | grep -q "auth/devstorage"
  120. }
  121. # Retry a download until we get it. Takes a hash and a set of URLs.
  122. #
  123. # $1 is the sha1 of the URL. Can be "" if the sha1 is unknown.
  124. # $2+ are the URLs to download.
  125. function download-or-bust {
  126. local -r hash="$1"
  127. shift 1
  128. local -r urls=( $* )
  129. while true; do
  130. for url in "${urls[@]}"; do
  131. local file="${url##*/}"
  132. rm -f "${file}"
  133. # if the url belongs to GCS API we should use oauth2_token in the headers
  134. local curl_headers=""
  135. if [[ "$url" =~ ^https://storage.googleapis.com.* ]] && valid-storage-scope ; then
  136. curl_headers="Authorization: Bearer $(get-credentials)"
  137. fi
  138. if ! curl ${curl_headers:+-H "${curl_headers}"} -f --ipv4 -Lo "${file}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 ${CURL_RETRY_CONNREFUSED} "${url}"; then
  139. echo "== Failed to download ${url}. Retrying. =="
  140. elif [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
  141. echo "== Hash validation of ${url} failed. Retrying. =="
  142. else
  143. if [[ -n "${hash}" ]]; then
  144. echo "== Downloaded ${url} (SHA1 = ${hash}) =="
  145. else
  146. echo "== Downloaded ${url} =="
  147. fi
  148. return
  149. fi
  150. done
  151. done
  152. }
  153. function is-preloaded {
  154. local -r key=$1
  155. local -r value=$2
  156. grep -qs "${key},${value}" "${KUBE_HOME}/preload_info"
  157. }
  158. function split-commas {
  159. echo $1 | tr "," "\n"
  160. }
  161. function remount-flexvolume-directory {
  162. local -r flexvolume_plugin_dir=$1
  163. mkdir -p $flexvolume_plugin_dir
  164. mount --bind $flexvolume_plugin_dir $flexvolume_plugin_dir
  165. mount -o remount,exec $flexvolume_plugin_dir
  166. }
  167. function install-gci-mounter-tools {
  168. CONTAINERIZED_MOUNTER_HOME="${KUBE_HOME}/containerized_mounter"
  169. local -r mounter_tar_sha="${DEFAULT_MOUNTER_TAR_SHA}"
  170. if is-preloaded "mounter" "${mounter_tar_sha}"; then
  171. echo "mounter is preloaded."
  172. return
  173. fi
  174. echo "Downloading gci mounter tools."
  175. mkdir -p "${CONTAINERIZED_MOUNTER_HOME}"
  176. chmod a+x "${CONTAINERIZED_MOUNTER_HOME}"
  177. mkdir -p "${CONTAINERIZED_MOUNTER_HOME}/rootfs"
  178. download-or-bust "${mounter_tar_sha}" "https://storage.googleapis.com/kubernetes-release/gci-mounter/mounter.tar"
  179. cp "${KUBE_HOME}/kubernetes/server/bin/mounter" "${CONTAINERIZED_MOUNTER_HOME}/mounter"
  180. chmod a+x "${CONTAINERIZED_MOUNTER_HOME}/mounter"
  181. mv "${KUBE_HOME}/mounter.tar" /tmp/mounter.tar
  182. tar xf /tmp/mounter.tar -C "${CONTAINERIZED_MOUNTER_HOME}/rootfs"
  183. rm /tmp/mounter.tar
  184. mkdir -p "${CONTAINERIZED_MOUNTER_HOME}/rootfs/var/lib/kubelet"
  185. }
  186. # Install node problem detector binary.
  187. function install-node-problem-detector {
  188. if [[ -n "${NODE_PROBLEM_DETECTOR_VERSION:-}" ]]; then
  189. local -r npd_version="${NODE_PROBLEM_DETECTOR_VERSION}"
  190. local -r npd_sha1="${NODE_PROBLEM_DETECTOR_TAR_HASH}"
  191. else
  192. local -r npd_version="${DEFAULT_NPD_VERSION}"
  193. local -r npd_sha1="${DEFAULT_NPD_SHA1}"
  194. fi
  195. local -r npd_tar="node-problem-detector-${npd_version}.tar.gz"
  196. if is-preloaded "${npd_tar}" "${npd_sha1}"; then
  197. echo "${npd_tar} is preloaded."
  198. return
  199. fi
  200. echo "Downloading ${npd_tar}."
  201. local -r npd_release_path="${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-https://storage.googleapis.com/kubernetes-release}"
  202. download-or-bust "${npd_sha1}" "${npd_release_path}/node-problem-detector/${npd_tar}"
  203. local -r npd_dir="${KUBE_HOME}/node-problem-detector"
  204. mkdir -p "${npd_dir}"
  205. tar xzf "${KUBE_HOME}/${npd_tar}" -C "${npd_dir}" --overwrite
  206. mv "${npd_dir}/bin"/* "${KUBE_BIN}"
  207. chmod a+x "${KUBE_BIN}/node-problem-detector"
  208. rmdir "${npd_dir}/bin"
  209. rm -f "${KUBE_HOME}/${npd_tar}"
  210. }
  211. function install-cni-binaries {
  212. if [[ -n "${CNI_VERSION:-}" ]]; then
  213. local -r cni_tar="cni-plugins-amd64-${CNI_VERSION}.tgz"
  214. local -r cni_sha1="${CNI_SHA1}"
  215. else
  216. local -r cni_tar="cni-plugins-amd64-${DEFAULT_CNI_VERSION}.tgz"
  217. local -r cni_sha1="${DEFAULT_CNI_SHA1}"
  218. fi
  219. if is-preloaded "${cni_tar}" "${cni_sha1}"; then
  220. echo "${cni_tar} is preloaded."
  221. return
  222. fi
  223. echo "Downloading cni binaries"
  224. download-or-bust "${cni_sha1}" "https://storage.googleapis.com/kubernetes-release/network-plugins/${cni_tar}"
  225. local -r cni_dir="${KUBE_HOME}/cni"
  226. mkdir -p "${cni_dir}/bin"
  227. tar xzf "${KUBE_HOME}/${cni_tar}" -C "${cni_dir}/bin" --overwrite
  228. mv "${cni_dir}/bin"/* "${KUBE_BIN}"
  229. rmdir "${cni_dir}/bin"
  230. rm -f "${KUBE_HOME}/${cni_tar}"
  231. }
  232. # Install crictl binary.
  233. function install-crictl {
  234. if [[ -n "${CRICTL_VERSION:-}" ]]; then
  235. local -r crictl_version="${CRICTL_VERSION}"
  236. local -r crictl_sha1="${CRICTL_TAR_HASH}"
  237. else
  238. local -r crictl_version="${DEFAULT_CRICTL_VERSION}"
  239. local -r crictl_sha1="${DEFAULT_CRICTL_SHA1}"
  240. fi
  241. local -r crictl="crictl-${crictl_version}-linux-amd64"
  242. # Create crictl config file.
  243. cat > /etc/crictl.yaml <<EOF
  244. runtime-endpoint: ${CONTAINER_RUNTIME_ENDPOINT:-unix:///var/run/dockershim.sock}
  245. EOF
  246. if is-preloaded "${crictl}" "${crictl_sha1}"; then
  247. echo "crictl is preloaded"
  248. return
  249. fi
  250. echo "Downloading crictl"
  251. local -r crictl_path="https://storage.googleapis.com/kubernetes-release/crictl"
  252. download-or-bust "${crictl_sha1}" "${crictl_path}/${crictl}"
  253. mv "${KUBE_HOME}/${crictl}" "${KUBE_BIN}/crictl"
  254. chmod a+x "${KUBE_BIN}/crictl"
  255. }
  256. function install-exec-auth-plugin {
  257. if [[ ! "${EXEC_AUTH_PLUGIN_URL:-}" ]]; then
  258. return
  259. fi
  260. local -r plugin_url="${EXEC_AUTH_PLUGIN_URL}"
  261. local -r plugin_sha1="${EXEC_AUTH_PLUGIN_SHA1}"
  262. echo "Downloading gke-exec-auth-plugin binary"
  263. download-or-bust "${plugin_sha1}" "${plugin_url}"
  264. mv "${KUBE_HOME}/gke-exec-auth-plugin" "${KUBE_BIN}/gke-exec-auth-plugin"
  265. chmod a+x "${KUBE_BIN}/gke-exec-auth-plugin"
  266. if [[ ! "${EXEC_AUTH_PLUGIN_LICENSE_URL:-}" ]]; then
  267. return
  268. fi
  269. local -r license_url="${EXEC_AUTH_PLUGIN_LICENSE_URL}"
  270. echo "Downloading gke-exec-auth-plugin license"
  271. download-or-bust "" "${license_url}"
  272. mv "${KUBE_HOME}/LICENSE" "${KUBE_BIN}/gke-exec-auth-plugin-license"
  273. }
  274. function install-kube-manifests {
  275. # Put kube-system pods manifests in ${KUBE_HOME}/kube-manifests/.
  276. local dst_dir="${KUBE_HOME}/kube-manifests"
  277. mkdir -p "${dst_dir}"
  278. local -r manifests_tar_urls=( $(split-commas "${KUBE_MANIFESTS_TAR_URL}") )
  279. local -r manifests_tar="${manifests_tar_urls[0]##*/}"
  280. if [ -n "${KUBE_MANIFESTS_TAR_HASH:-}" ]; then
  281. local -r manifests_tar_hash="${KUBE_MANIFESTS_TAR_HASH}"
  282. else
  283. echo "Downloading k8s manifests sha1 (not found in env)"
  284. download-or-bust "" "${manifests_tar_urls[@]/.tar.gz/.tar.gz.sha1}"
  285. local -r manifests_tar_hash=$(cat "${manifests_tar}.sha1")
  286. fi
  287. if is-preloaded "${manifests_tar}" "${manifests_tar_hash}"; then
  288. echo "${manifests_tar} is preloaded."
  289. return
  290. fi
  291. echo "Downloading k8s manifests tar"
  292. download-or-bust "${manifests_tar_hash}" "${manifests_tar_urls[@]}"
  293. tar xzf "${KUBE_HOME}/${manifests_tar}" -C "${dst_dir}" --overwrite
  294. local -r kube_addon_registry="${KUBE_ADDON_REGISTRY:-k8s.gcr.io}"
  295. if [[ "${kube_addon_registry}" != "k8s.gcr.io" ]]; then
  296. find "${dst_dir}" -name \*.yaml -or -name \*.yaml.in | \
  297. xargs sed -ri "s@(image:\s.*)k8s.gcr.io@\1${kube_addon_registry}@"
  298. find "${dst_dir}" -name \*.manifest -or -name \*.json | \
  299. xargs sed -ri "s@(image\":\s+\")k8s.gcr.io@\1${kube_addon_registry}@"
  300. fi
  301. cp "${dst_dir}/kubernetes/gci-trusty/gci-configure-helper.sh" "${KUBE_BIN}/configure-helper.sh"
  302. if [[ -e "${dst_dir}/kubernetes/gci-trusty/gke-internal-configure-helper.sh" ]]; then
  303. cp "${dst_dir}/kubernetes/gci-trusty/gke-internal-configure-helper.sh" "${KUBE_BIN}/"
  304. fi
  305. cp "${dst_dir}/kubernetes/gci-trusty/health-monitor.sh" "${KUBE_BIN}/health-monitor.sh"
  306. rm -f "${KUBE_HOME}/${manifests_tar}"
  307. rm -f "${KUBE_HOME}/${manifests_tar}.sha1"
  308. }
  309. # A helper function for loading a docker image. It keeps trying up to 5 times.
  310. #
  311. # $1: Full path of the docker image
  312. function try-load-docker-image {
  313. local -r img=$1
  314. echo "Try to load docker image file ${img}"
  315. # Temporarily turn off errexit, because we don't want to exit on first failure.
  316. set +e
  317. local -r max_attempts=5
  318. local -i attempt_num=1
  319. until timeout 30 ${LOAD_IMAGE_COMMAND:-docker load -i} "${img}"; do
  320. if [[ "${attempt_num}" == "${max_attempts}" ]]; then
  321. echo "Fail to load docker image file ${img} after ${max_attempts} retries. Exit!!"
  322. exit 1
  323. else
  324. attempt_num=$((attempt_num+1))
  325. sleep 5
  326. fi
  327. done
  328. # Re-enable errexit.
  329. set -e
  330. }
  331. # Loads kube-system docker images. It is better to do it before starting kubelet,
  332. # as kubelet will restart docker daemon, which may interfere with loading images.
  333. function load-docker-images {
  334. echo "Start loading kube-system docker images"
  335. local -r img_dir="${KUBE_HOME}/kube-docker-files"
  336. if [[ "${KUBERNETES_MASTER:-}" == "true" ]]; then
  337. try-load-docker-image "${img_dir}/kube-apiserver.tar"
  338. try-load-docker-image "${img_dir}/kube-controller-manager.tar"
  339. try-load-docker-image "${img_dir}/kube-scheduler.tar"
  340. else
  341. try-load-docker-image "${img_dir}/kube-proxy.tar"
  342. fi
  343. }
  344. # Downloads kubernetes binaries and kube-system manifest tarball, unpacks them,
  345. # and places them into suitable directories. Files are placed in /home/kubernetes.
  346. function install-kube-binary-config {
  347. cd "${KUBE_HOME}"
  348. local -r server_binary_tar_urls=( $(split-commas "${SERVER_BINARY_TAR_URL}") )
  349. local -r server_binary_tar="${server_binary_tar_urls[0]##*/}"
  350. if [[ -n "${SERVER_BINARY_TAR_HASH:-}" ]]; then
  351. local -r server_binary_tar_hash="${SERVER_BINARY_TAR_HASH}"
  352. else
  353. echo "Downloading binary release sha1 (not found in env)"
  354. download-or-bust "" "${server_binary_tar_urls[@]/.tar.gz/.tar.gz.sha1}"
  355. local -r server_binary_tar_hash=$(cat "${server_binary_tar}.sha1")
  356. fi
  357. if is-preloaded "${server_binary_tar}" "${server_binary_tar_hash}"; then
  358. echo "${server_binary_tar} is preloaded."
  359. else
  360. echo "Downloading binary release tar"
  361. download-or-bust "${server_binary_tar_hash}" "${server_binary_tar_urls[@]}"
  362. tar xzf "${KUBE_HOME}/${server_binary_tar}" -C "${KUBE_HOME}" --overwrite
  363. # Copy docker_tag and image files to ${KUBE_HOME}/kube-docker-files.
  364. local -r src_dir="${KUBE_HOME}/kubernetes/server/bin"
  365. local dst_dir="${KUBE_HOME}/kube-docker-files"
  366. mkdir -p "${dst_dir}"
  367. cp "${src_dir}/"*.docker_tag "${dst_dir}"
  368. if [[ "${KUBERNETES_MASTER:-}" == "false" ]]; then
  369. cp "${src_dir}/kube-proxy.tar" "${dst_dir}"
  370. else
  371. cp "${src_dir}/kube-apiserver.tar" "${dst_dir}"
  372. cp "${src_dir}/kube-controller-manager.tar" "${dst_dir}"
  373. cp "${src_dir}/kube-scheduler.tar" "${dst_dir}"
  374. cp -r "${KUBE_HOME}/kubernetes/addons" "${dst_dir}"
  375. fi
  376. load-docker-images
  377. mv "${src_dir}/kubelet" "${KUBE_BIN}"
  378. mv "${src_dir}/kubectl" "${KUBE_BIN}"
  379. mv "${KUBE_HOME}/kubernetes/LICENSES" "${KUBE_HOME}"
  380. mv "${KUBE_HOME}/kubernetes/kubernetes-src.tar.gz" "${KUBE_HOME}"
  381. fi
  382. if [[ "${KUBERNETES_MASTER:-}" == "false" ]] && \
  383. [[ "${ENABLE_NODE_PROBLEM_DETECTOR:-}" == "standalone" ]]; then
  384. install-node-problem-detector
  385. fi
  386. if [[ "${NETWORK_PROVIDER:-}" == "kubenet" ]] || \
  387. [[ "${NETWORK_PROVIDER:-}" == "cni" ]]; then
  388. install-cni-binaries
  389. fi
  390. # Put kube-system pods manifests in ${KUBE_HOME}/kube-manifests/.
  391. install-kube-manifests
  392. chmod -R 755 "${KUBE_BIN}"
  393. # Install gci mounter related artifacts to allow mounting storage volumes in GCI
  394. install-gci-mounter-tools
  395. # Remount the Flexvolume directory with the "exec" option, if needed.
  396. if [[ "${REMOUNT_VOLUME_PLUGIN_DIR:-}" == "true" && -n "${VOLUME_PLUGIN_DIR:-}" ]]; then
  397. remount-flexvolume-directory "${VOLUME_PLUGIN_DIR}"
  398. fi
  399. # Install crictl on each node.
  400. install-crictl
  401. # TODO(awly): include the binary and license in the OS image.
  402. install-exec-auth-plugin
  403. # Clean up.
  404. rm -rf "${KUBE_HOME}/kubernetes"
  405. rm -f "${KUBE_HOME}/${server_binary_tar}"
  406. rm -f "${KUBE_HOME}/${server_binary_tar}.sha1"
  407. }
  408. ######### Main Function ##########
  409. echo "Start to install kubernetes files"
  410. # if install fails, message-of-the-day (motd) will warn at login shell
  411. set-broken-motd
  412. KUBE_HOME="/home/kubernetes"
  413. KUBE_BIN="${KUBE_HOME}/bin"
  414. # download and source kube-env
  415. download-kube-env
  416. source "${KUBE_HOME}/kube-env"
  417. download-kubelet-config "${KUBE_HOME}/kubelet-config.yaml"
  418. # master certs
  419. if [[ "${KUBERNETES_MASTER:-}" == "true" ]]; then
  420. download-kube-master-certs
  421. fi
  422. # binaries and kube-system manifests
  423. install-kube-binary-config
  424. echo "Done for installing kubernetes files"