k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/cluster/kube-up.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2014 The Kubernetes Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # Bring up a Kubernetes cluster. 18 # 19 # If the full release name (gs://<bucket>/<release>) is passed in then we take 20 # that directly. If not then we assume we are doing development stuff and take 21 # the defaults in the release config. 22 23 set -o errexit 24 set -o nounset 25 set -o pipefail 26 27 KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 28 29 if [ -f "${KUBE_ROOT}/cluster/env.sh" ]; then 30 source "${KUBE_ROOT}/cluster/env.sh" 31 fi 32 33 source "${KUBE_ROOT}/cluster/kube-util.sh" 34 35 if [ -z "${ZONE-}" ]; then 36 echo "... Starting cluster using provider: ${KUBERNETES_PROVIDER}" >&2 37 else 38 echo "... Starting cluster in ${ZONE} using provider ${KUBERNETES_PROVIDER}" >&2 39 fi 40 41 echo "... calling verify-prereqs" >&2 42 verify-prereqs 43 echo "... calling verify-kube-binaries" >&2 44 verify-kube-binaries 45 echo "... calling verify-release-tars" >&2 46 verify-release-tars 47 48 echo "... calling kube-up" >&2 49 kube-up 50 51 echo "... calling validate-cluster" >&2 52 # Override errexit 53 (validate-cluster) && validate_result="$?" || validate_result="$?" 54 55 # We have two different failure modes from validate cluster: 56 # - 1: fatal error - cluster won't be working correctly 57 # - 2: weak error - something went wrong, but cluster probably will be working correctly 58 # We just print an error message in case 2). 59 if [[ "${validate_result}" == "1" ]]; then 60 exit 1 61 elif [[ "${validate_result}" == "2" ]]; then 62 echo "...ignoring non-fatal errors in validate-cluster" >&2 63 fi 64 65 if [[ "${ENABLE_PROXY:-}" == "true" ]]; then 66 # shellcheck disable=SC1091 67 . /tmp/kube-proxy-env 68 echo "" 69 echo "*** Please run the following to add the kube-apiserver endpoint to your proxy white-list ***" 70 cat /tmp/kube-proxy-env 71 echo "*** ***" 72 echo "" 73 fi 74 75 echo -e "Done, listing cluster services:\n" >&2 76 "${KUBE_ROOT}/cluster/kubectl.sh" cluster-info 77 echo 78 79 exit 0