k3s/cluster/gce/trusty/node.yaml

278 lines
6.9 KiB
YAML

From nobody Tue Aug 11 10:13:54 2015
Content-Type: multipart/mixed; boundary="===================================="
MIME-Version: 1.0
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-env.conf"
#upstart-job
description "Prepare kube node environment"
start on cloud-config
script
set -o errexit
set -o nounset
# Fetch the script for configuring the instance.
curl --fail --silent --show-error \
-H "X-Google-Metadata-Request: True" \
-o /etc/kube-configure.sh \
http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh
. /etc/kube-configure.sh
echo "Configuring hostname"
config_hostname
echo "Configuring IP firewall rules"
config_ip_firewall
echo "Creating required directories"
create_dirs
echo "Downloading kube-env file"
download_kube_env
echo "Creating kubelet kubeconfig file"
create_kubelet_kubeconfig
echo "Creating kube-proxy kubeconfig file"
create_kubeproxy_kubeconfig
end script
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-install-packages.conf"
#upstart-job
description "Install packages needed to run kubernetes"
start on stopped kube-env
script
set -o errexit
set -o nounset
. /etc/kube-configure.sh
install_critical_packages
end script
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-install-additional-packages.conf"
#upstart-job
description "Install additional packages used by kubernetes"
start on stopped kube-install-packages
script
set -o errexit
set -o nounset
. /etc/kube-configure.sh
install_additional_packages
end script
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-install-minion.conf"
#upstart-job
description "Download and install k8s binaries and configurations"
start on stopped kube-env
script
set -o errexit
set -o nounset
. /etc/kube-configure.sh
install_kube_binary_config
end script
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kubelet.conf"
#upstart-job
description "Run kubelet service"
start on stopped kube-install-minion and stopped kube-install-packages
respawn
script
set -o errexit
set -o nounset
. /etc/kube-env
ARGS="--v=2"
if [ -n "${KUBELET_TEST_ARGS:-}" ]; then
ARGS="${KUBELET_TEST_ARGS}"
fi
BINARY_PATH="/usr/bin/kubelet"
if [ "${TEST_CLUSTER:-}" = "true" ]; then
BINARY_PATH="/usr/local/bin/kubelet"
fi
${BINARY_PATH} \
--api-servers=https://${KUBERNETES_MASTER_NAME} \
--enable-debugging-handlers=true \
--cloud-provider=gce \
--config=/etc/kubernetes/manifests \
--allow-privileged=true \
--cluster-dns=${DNS_SERVER_IP} \
--cluster-domain=${DNS_DOMAIN} \
--configure-cbr0=true \
--cgroup-root=/ \
--system-container=/system \
${ARGS}
end script
# Wait for 10s to start kubelet again.
post-stop exec sleep 10
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-proxy.conf"
#upstart-job
description "Start kube-proxy service"
start on stopped kube-install-minion and stopped kube-install-packages
respawn
script
set -o errexit
set -o nounset
. /etc/kube-env
ARGS="--v=2"
if [ -n "${KUBEPROXY_TEST_ARGS:-}" ]; then
ARGS="${KUBEPROXY_TEST_ARGS}"
fi
BINARY_PATH="/usr/bin/kube-proxy"
if [ "${TEST_CLUSTER:-}" = "true" ]; then
BINARY_PATH="/usr/local/bin/kube-proxy"
fi
${BINARY_PATH} \
--master=https://${KUBERNETES_MASTER_NAME} \
--kubeconfig=/var/lib/kube-proxy/kubeconfig \
${ARGS}
end script
# Wait for 10s to start kube-proxy again.
post-stop exec sleep 10
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-docker.conf"
#upstart-job
description "Restart docker daemon"
# The condition "stopped kube-install-additional-packages" is to avoid
# breaking nsenter installation, which is through a docker container.
# It can be removed if we find a better way to install nsenter.
start on started kubelet and stopped kube-install-additional-packages
script
set -o errexit
set -o nounset
. /etc/kube-configure.sh
restart_docker_daemon
end script
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-addons.conf"
#upstart-job
description "Install kubelet add-on manifest files"
start on stopped kube-docker
script
set -o errexit
set -o nounset
# Configuration files are located at /etc/saltbase.
. /etc/kube-env
# Fluentd
if [ "${ENABLE_NODE_LOGGING:-}" = "true" ]; then
if [ "${LOGGING_DESTINATION:-}" = "gcp" ]; then
cp /etc/saltbase/kubernetes/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml /etc/kubernetes/manifests/
elif [ "${LOGGING_DESTINATION:-}" = "elasticsearch" ]; then
cp /etc/saltbase/kubernetes/saltbase/salt/fluentd-es/fluentd-es.yaml /etc/kubernetes/manifests/
fi
fi
# Kube-registry-proxy
if [ "${ENABLE_CLUSTER_REGISTRY:-}" = "true" ]; then
cp /etc/saltbase/kubernetes/saltbase/salt/kube-registry-proxy/kube-registry-proxy.yaml /etc/kubernetes/manifests/
fi
end script
--====================================
MIME-Version: 1.0
Content-Type: text/upstart-job; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kube-node-health-monitoring.conf"
description "Kubenetes node health monitoring"
start on stopped kube-docker and started kube-proxy
respawn
script
set -o nounset
# Wait for a minute to let docker, kubelet, and kube-proxy processes finish initialization.
# TODO(andyzheng0831): replace it with a more reliable method if possible.
sleep 60
sleep_seconds=10
max_seconds=10
# We simply kill the process when there is a failure. Another upstart job will automatically
# restart the process.
while [ 1 ]; do
if ! timeout 10 docker version > /dev/null; then
echo "Docker daemon failed!"
pkill docker
fi
if ! curl --insecure -m ${max_seconds} -f -s https://127.0.0.1:10250/healthz > /dev/null; then
echo "Kubelet is unhealthy!"
pkill kubelet
fi
if ! curl -m ${max_seconds} -f -s http://127.0.0.1:10249/healthz > /dev/null; then
echo "Kube-proxy is unhealthy!"
pkill kube-proxy
fi
sleep ${sleep_seconds}
done
end script
--====================================--