diff --git a/cluster/gce/trusty/configure-helper.sh b/cluster/gce/trusty/configure-helper.sh index b0c24483bd2..ee41ebdea10 100644 --- a/cluster/gce/trusty/configure-helper.sh +++ b/cluster/gce/trusty/configure-helper.sh @@ -181,10 +181,14 @@ assemble_kubelet_flags() { fi # Add the unconditional flags KUBELET_CMD_FLAGS="${KUBELET_CMD_FLAGS} --cloud-provider=gce --allow-privileged=true --cgroup-root=/ --system-cgroups=/system --kubelet-cgroups=/kubelet --babysit-daemons=true --config=/etc/kubernetes/manifests --cluster-dns=${DNS_SERVER_IP} --cluster-domain=${DNS_DOMAIN}" + echo "KUBELET_OPTS=\"${KUBELET_CMD_FLAGS}\"" > /etc/default/kubelet } restart_docker_daemon() { - readonly DOCKER_OPTS="-p /var/run/docker.pid --bridge=cbr0 --iptables=false --ip-masq=false" + DOCKER_OPTS="-p /var/run/docker.pid --bridge=cbr0 --iptables=false --ip-masq=false" + if [ "${TEST_CLUSTER:-}" = "true" ]; then + DOCKER_OPTS="${DOCKER_OPTS} --debug" + fi echo "DOCKER_OPTS=\"${DOCKER_OPTS} ${EXTRA_DOCKER_OPTS:-}\"" > /etc/default/docker # Make sure the network interface cbr0 is created before restarting docker daemon while ! [ -L /sys/class/net/cbr0 ]; do diff --git a/cluster/gce/trusty/helper.sh b/cluster/gce/trusty/helper.sh index 8f351a333fc..d12eafaca4a 100755 --- a/cluster/gce/trusty/helper.sh +++ b/cluster/gce/trusty/helper.sh @@ -16,11 +16,9 @@ # A library of helper functions and constant for ubuntu os distro -# The code and configuration is for running node instances on Ubuntu images. -# The master is still on Debian. In addition, the configuration is based on -# upstart, which is in Ubuntu up to 14.04 LTS (Trusty). Ubuntu 15.04 and above -# replaced upstart with systemd as the init system. Consequently, the -# configuration cannot work on these images. +# The configuration is based on upstart, which is in Ubuntu up to 14.04 LTS (Trusty). +# Ubuntu 15.04 and above replaced upstart with systemd as the init system. +# Consequently, the configuration cannot work on these images. # $1: template name (required) diff --git a/cluster/gce/trusty/master.yaml b/cluster/gce/trusty/master.yaml index 0cedb7b9d3d..b171c628fe6 100644 --- a/cluster/gce/trusty/master.yaml +++ b/cluster/gce/trusty/master.yaml @@ -60,7 +60,10 @@ script echo "Creating kubernetes master auth file" create_master_auth echo "Creating master instance kubelet auth file" - create_master_kubelet_auth + create_master_kubelet_auth + echo "Assemble kubelet command line" + # Kubelet command flags will be written in /etc/default/kubelet + assemble_kubelet_flags end script --==================================== @@ -122,12 +125,8 @@ script set -o nounset echo "Start kubelet upstart job" - . /etc/kube-configure-helper.sh - . /etc/kube-env - # Assemble command line flags based on env variables, which will put the string - # of flags in variable KUBELET_CMD_FLAGS - assemble_kubelet_flags - /usr/bin/kubelet ${KUBELET_CMD_FLAGS} 1>>/var/log/kubelet.log 2>&1 + . /etc/default/kubelet + /usr/bin/kubelet ${KUBELET_OPTS} 1>>/var/log/kubelet.log 2>&1 end script # Wait for 10s to start kubelet again. diff --git a/cluster/gce/trusty/node.yaml b/cluster/gce/trusty/node.yaml index e594a08b32c..b70b051b7da 100644 --- a/cluster/gce/trusty/node.yaml +++ b/cluster/gce/trusty/node.yaml @@ -59,6 +59,9 @@ script create_kubelet_kubeconfig echo "Creating kube-proxy kubeconfig file" create_kubeproxy_kubeconfig + echo "Assemble kubelet command line" + # Kubelet command flags will be in /etc/default/kubelet + assemble_kubelet_flags end script --==================================== @@ -120,12 +123,8 @@ script set -o nounset echo "Start kubelet upstart job" - . /etc/kube-configure-helper.sh - . /etc/kube-env - # Assemble command line flags based on env variables, which will put the string - # of flags in variable KUBELET_CMD_FLAGS. - assemble_kubelet_flags - /usr/bin/kubelet ${KUBELET_CMD_FLAGS} 1>>/var/log/kubelet.log 2>&1 + . /etc/default/kubelet + /usr/bin/kubelet ${KUBELET_OPTS} 1>>/var/log/kubelet.log 2>&1 end script # Wait for 10s to start kubelet again. @@ -232,8 +231,7 @@ script start_fluentd # Kube-registry-proxy if [ "${ENABLE_CLUSTER_REGISTRY:-}" = "true" ]; then - cp /home/kubernetes/kube-manifests/kubernetes/kube-registry-proxy.yaml \ - /etc/kubernetes/manifests/ + cp /home/kubernetes/kube-manifests/kubernetes/kube-registry-proxy.yaml /etc/kubernetes/manifests/ fi end script