From 6698ac6dcc217f2f6c590be321f478460f3488b9 Mon Sep 17 00:00:00 2001 From: Robert Roland Date: Fri, 20 Nov 2015 15:13:11 -0800 Subject: [PATCH 1/2] Need to source the config-default.sh file before modifying the /etc/default/docker file, otherwise the DOCKER_OPTS set there do not get applied to new minion nodes. --- cluster/ubuntu/reconfDocker.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cluster/ubuntu/reconfDocker.sh b/cluster/ubuntu/reconfDocker.sh index 42bfb7d05d00..d2544d499126 100755 --- a/cluster/ubuntu/reconfDocker.sh +++ b/cluster/ubuntu/reconfDocker.sh @@ -46,7 +46,9 @@ function config_etcd { } function restart_docker { - + + source ~/kube/config-default.sh + attempt=0 while [[ ! -f /run/flannel/subnet.env ]]; do if (( attempt > 200 )); then From ebeb7bc524ce08f156417fa4493f86fdb62e9f60 Mon Sep 17 00:00:00 2001 From: Robert Roland Date: Fri, 20 Nov 2015 19:07:42 -0800 Subject: [PATCH 2/2] Removing quoting of the PROXY_SETTING value. When PROXY_SETTING is empty, you end up an empty command of "", as witnessed by this bash debug output when +x is enabled: + '' /home/ubuntu/kube/make-ca-cert.sh 10.0.0.232 IP:10.0.0.232,IP:192.168.3.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local Given the example: PROXY_SETTING="http_proxy=http://server:port https_proxy=https://server:port" You would not want this quoted on the script executed on the remote master or minion node. Enabling +e, for additional tracing and to abort on any failure in the remote SSH session. Adding a DEBUG parameter into config-default.sh allowing additional debug information to be present in the logs during node rollout, using bash's "set -x" when DEBUG=true --- cluster/ubuntu/config-default.sh | 2 ++ cluster/ubuntu/reconfDocker.sh | 8 ++------ cluster/ubuntu/util.sh | 31 ++++++++++++++++++++++++++++--- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/cluster/ubuntu/config-default.sh b/cluster/ubuntu/config-default.sh index 16b6c65bad5e..9e4bfd623874 100755 --- a/cluster/ubuntu/config-default.sh +++ b/cluster/ubuntu/config-default.sh @@ -71,3 +71,5 @@ ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}" # Add envitonment variable separated with blank space like "http_proxy=http://10.x.x.x:8080 https_proxy=https://10.x.x.x:8443" PROXY_SETTING=${PROXY_SETTING:-""} +DEBUG=${DEBUG:-"false"} + diff --git a/cluster/ubuntu/reconfDocker.sh b/cluster/ubuntu/reconfDocker.sh index d2544d499126..82624f89acf6 100755 --- a/cluster/ubuntu/reconfDocker.sh +++ b/cluster/ubuntu/reconfDocker.sh @@ -16,6 +16,8 @@ # reconfigure docker network setting +source ~/kube/config-default.sh + if [ "$(id -u)" != "0" ]; then echo >&2 "Please run as root" exit 1 @@ -23,9 +25,6 @@ fi function config_etcd { - - source ~/kube/config-default.sh - attempt=0 while true; do /opt/bin/etcdctl get /coreos.com/network/config @@ -46,9 +45,6 @@ function config_etcd { } function restart_docker { - - source ~/kube/config-default.sh - attempt=0 while [[ ! -f /run/flannel/subnet.env ]]; do if (( attempt > 200 )); then diff --git a/cluster/ubuntu/util.sh b/cluster/ubuntu/util.sh index f35906ea17a6..21ae96ce2275 100755 --- a/cluster/ubuntu/util.sh +++ b/cluster/ubuntu/util.sh @@ -373,8 +373,15 @@ function provision-master() { EXTRA_SANS=$(echo "${EXTRA_SANS[@]}" | tr ' ' ,) + BASH_DEBUG_FLAGS="" + if [[ "$DEBUG" == "true" ]] ; then + BASH_DEBUG_FLAGS="set -x" + fi + # remote login to MASTER and configue k8s master ssh $SSH_OPTS -t "${MASTER}" " + set +e + ${BASH_DEBUG_FLAGS} source ~/kube/util.sh setClusterInfo @@ -386,7 +393,9 @@ function provision-master() { create-kube-controller-manager-opts '${NODE_IPS}' create-kube-scheduler-opts create-flanneld-opts '127.0.0.1' '${MASTER_IP}' - sudo -E -p '[sudo] password to start master: ' -- /bin/bash -c ' + sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce ' + ${BASH_DEBUG_FLAGS} + cp ~/kube/default/* /etc/default/ cp ~/kube/init_conf/* /etc/init/ cp ~/kube/init_scripts/* /etc/init.d/ @@ -418,8 +427,15 @@ function provision-node() { ubuntu/binaries/minion \ "${1}:~/kube" + BASH_DEBUG_FLAGS="" + if [[ "$DEBUG" == "true" ]] ; then + BASH_DEBUG_FLAGS="set -x" + fi + # remote login to node and configue k8s node ssh $SSH_OPTS -t "$1" " + set +e + ${BASH_DEBUG_FLAGS} source ~/kube/util.sh setClusterInfo @@ -433,7 +449,8 @@ function provision-node() { '${MASTER_IP}' create-flanneld-opts '${MASTER_IP}' '${1#*@}' - sudo -E -p '[sudo] password to start node: ' -- /bin/bash -c ' + sudo -E -p '[sudo] password to start node: ' -- /bin/bash -ce ' + ${BASH_DEBUG_FLAGS} cp ~/kube/default/* /etc/default/ cp ~/kube/init_conf/* /etc/init/ cp ~/kube/init_scripts/* /etc/init.d/ @@ -477,8 +494,15 @@ function provision-masterandnode() { EXTRA_SANS=$(echo "${EXTRA_SANS[@]}" | tr ' ' ,) + BASH_DEBUG_FLAGS="" + if [[ "$DEBUG" == "true" ]] ; then + BASH_DEBUG_FLAGS="set -x" + fi + # remote login to the master/node and configue k8s ssh $SSH_OPTS -t "$MASTER" " + set +e + ${BASH_DEBUG_FLAGS} source ~/kube/util.sh setClusterInfo @@ -499,7 +523,8 @@ function provision-masterandnode() { '${MASTER_IP}' create-flanneld-opts '127.0.0.1' '${MASTER_IP}' - sudo -E -p '[sudo] password to start master: ' -- /bin/bash -c ' + sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce ' + ${BASH_DEBUG_FLAGS} cp ~/kube/default/* /etc/default/ cp ~/kube/init_conf/* /etc/init/ cp ~/kube/init_scripts/* /etc/init.d/