finish the multinode ubuntu k8s setup script and guide ,tested ok
This commit is contained in:
100
cluster/ubuntu-cluster/initd_scripts/etcd
Executable file
100
cluster/ubuntu-cluster/initd_scripts/etcd
Executable file
@@ -0,0 +1,100 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: etcd
|
||||
# Required-Start: $docker
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: Start distrubted key/value pair service
|
||||
# Description:
|
||||
# http://www.github.com/coreos/etcd
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin:
|
||||
|
||||
BASE=$(basename $0)
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/etcd)
|
||||
ETCD=/opt/bin/$BASE
|
||||
# This is the pid file managed by etcd itself
|
||||
ETCD_PIDFILE=/var/run/$BASE.pid
|
||||
ETCD_LOGFILE=/var/log/$BASE.log
|
||||
ETCD_OPTS=""
|
||||
ETCD_DESC="Etcd"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it)
|
||||
if false && [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
|
||||
log_failure_msg "$ETCD_DESC is managed via upstart, try using service $BASE $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check etcd is present
|
||||
if [ ! -x $ETCD ]; then
|
||||
log_failure_msg "$ETCD not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$ETCD_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
ETCD_START="start-stop-daemon \
|
||||
--start \
|
||||
--background \
|
||||
--quiet \
|
||||
--exec $ETCD \
|
||||
--make-pidfile \
|
||||
--pidfile $ETCD_PIDFILE \
|
||||
-- $ETCD_OPTS \
|
||||
>> $ETCD_LOGFILE 2>&1"
|
||||
|
||||
ETCD_STOP="start-stop-daemon \
|
||||
--stop \
|
||||
--pidfile $ETCD_PIDFILE"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
log_begin_msg "Starting $ETCD_DESC: $BASE"
|
||||
$ETCD_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $ETCD_DESC: $BASE"
|
||||
$ETCD_STOP
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
restart | force-reload)
|
||||
fail_unless_root
|
||||
log_begin_msg "Restarting $ETCD_DESC: $BASE"
|
||||
$ETCD_STOP
|
||||
$ETCD_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$ETCD_PIDFILE" "$ETCD" "$ETCD_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
99
cluster/ubuntu-cluster/initd_scripts/flanneld
Executable file
99
cluster/ubuntu-cluster/initd_scripts/flanneld
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: flannel
|
||||
# Required-Start: $etcd
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: Start flannel networking service
|
||||
# Description:
|
||||
# https://github.com/coreos/flannel
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin:
|
||||
|
||||
BASE=$(basename $0)
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/flannel)
|
||||
FLANNEL=/opt/bin/$BASE
|
||||
# This is the pid file managed by kube-apiserver itself
|
||||
FLANNEL_PIDFILE=/var/run/$BASE.pid
|
||||
FLANNEL_LOGFILE=/var/log/$BASE.log
|
||||
FLANNEL_OPTS=""
|
||||
FLANNEL_DESC="Flannel"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it)
|
||||
if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
|
||||
log_failure_msg "$FLANNEL_DESC is managed via upstart, try using service $BASE $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check flanneld is present
|
||||
if [ ! -x $FLANNEL ]; then
|
||||
log_failure_msg "$FLANNEL not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$FLANNEL_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
FLANNEL_START="start-stop-daemon \
|
||||
--start \
|
||||
--background \
|
||||
--quiet \
|
||||
--exec $FLANNEL \
|
||||
--make-pidfile --pidfile $FLANNEL_PIDFILE \
|
||||
-- $FLANNEL_OPTS \
|
||||
>> $FLANNEL_LOGFILE 2>&1"
|
||||
|
||||
FLANNEL_STOP="start-stop-daemon \
|
||||
--stop \
|
||||
--pidfile $FLANNEL_PIDFILE"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
log_begin_msg "Starting $FLANNEL_DESC: $BASE"
|
||||
$KUBE_APISERVER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $FLANNEL_DESC: $BASE"
|
||||
$KUBE_APISERVER_STOP
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
restart | force-reload)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $FLANNEL_DESC: $BASE"
|
||||
$KUBE_APISERVER_STOP
|
||||
$KUBE_APISERVER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$FLANNEL_DESC" "$FLANNEL" "$FLANNEL_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
99
cluster/ubuntu-cluster/initd_scripts/kube-apiserver
Executable file
99
cluster/ubuntu-cluster/initd_scripts/kube-apiserver
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kube-apiserver
|
||||
# Required-Start: $etcd
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: Start distrubted key/value pair service
|
||||
# Description:
|
||||
# http://www.github.com/GoogleCloudPlatform/Kubernetes
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin:
|
||||
|
||||
BASE=$(basename $0)
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/kube-apiserver)
|
||||
KUBE_APISERVER=/opt/bin/$BASE
|
||||
# This is the pid file managed by kube-apiserver itself
|
||||
KUBE_APISERVER_PIDFILE=/var/run/$BASE.pid
|
||||
KUBE_APISERVER_LOGFILE=/var/log/$BASE.log
|
||||
KUBE_APISERVER_OPTS=""
|
||||
KUBE_APISERVER_DESC="Kube-Apiserver"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it)
|
||||
if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
|
||||
log_failure_msg "$KUBE_APISERVER_DESC is managed via upstart, try using service $BASE $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check kube-apiserver is present
|
||||
if [ ! -x $KUBE_APISERVER ]; then
|
||||
log_failure_msg "$KUBE_APISERVER not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$KUBE_APISERVER_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
KUBE_APISERVER_START="start-stop-daemon \
|
||||
--start \
|
||||
--background \
|
||||
--quiet \
|
||||
--exec $KUBE_APISERVER \
|
||||
--make-pidfile --pidfile $KUBE_APISERVER_PIDFILE \
|
||||
-- $KUBE_APISERVER_OPTS \
|
||||
>> $KUBE_APISERVER_LOGFILE 2>&1"
|
||||
|
||||
KUBE_APISERVER_STOP="start-stop-daemon \
|
||||
--stop \
|
||||
--pidfile $KUBE_APISERVER_PIDFILE"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
log_begin_msg "Starting $KUBE_APISERVER_DESC: $BASE"
|
||||
$KUBE_APISERVER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBE_APISERVER_DESC: $BASE"
|
||||
$KUBE_APISERVER_STOP
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
restart | force-reload)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBE_APISERVER_DESC: $BASE"
|
||||
$KUBE_APISERVER_STOP
|
||||
$KUBE_APISERVER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$KUBE_APISERVER_PIDFILE" "$KUBE_APISERVER" "$KUBE_APISERVER_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
99
cluster/ubuntu-cluster/initd_scripts/kube-controller-manager
Executable file
99
cluster/ubuntu-cluster/initd_scripts/kube-controller-manager
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kube-controller-manager
|
||||
# Required-Start: $etcd
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: Start distrubted key/value pair service
|
||||
# Description:
|
||||
# http://www.github.com/GoogleCloudPlatform/Kubernetes
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin:
|
||||
|
||||
BASE=$(basename $0)
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/kube-controller-manager)
|
||||
KUBE_CONTROLLER_MANAGER=/opt/bin/$BASE
|
||||
# This is the pid file managed by kube-controller-manager itself
|
||||
KUBE_CONTROLLER_MANAGER_PIDFILE=/var/run/$BASE.pid
|
||||
KUBE_CONTROLLER_MANAGER_LOGFILE=/var/log/$BASE.log
|
||||
KUBE_CONTROLLER_MANAGER_OPTS=""
|
||||
KUBE_CONTROLLER_MANAGER_DESC="Kube-Controller-Manager"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it)
|
||||
if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
|
||||
log_failure_msg "$KUBE_CONTROLLER_MANAGER_DESC is managed via upstart, try using service $BASE $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check kube-controller-manager is present
|
||||
if [ ! -x $KUBE_CONTROLLER_MANAGER ]; then
|
||||
log_failure_msg "$KUBE_CONTROLLER_MANAGER not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$KUBE_CONTROLLER_MANAGER_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
KUBE_CONTROLLER_MANAGER_START="start-stop-daemon
|
||||
--start --background \
|
||||
--quiet \
|
||||
--exec $KUBE_CONTROLLER_MANAGER \
|
||||
--make-pidfile \
|
||||
--pidfile $KUBE_CONTROLLER_MANAGER_PIDFILE \
|
||||
-- $KUBE_CONTROLLER_MANAGER_OPTS \
|
||||
>> "$KUBE_CONTROLLER_MANAGER_LOGFILE" 2>&1
|
||||
|
||||
KUBE_CONTROLLER_MANAGER_STOP="start-stop-daemon \
|
||||
--stop \
|
||||
--pidfile $KUBE_CONTROLLER_MANAGER_PIDFILE"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
log_begin_msg "Starting $KUBE_CONTROLLER_MANAGER_DESC: $BASE"
|
||||
$KUBE_CONTROLLER_MANAGER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBE_CONTROLLER_MANAGER_DESC: $BASE"
|
||||
$KUBE_CONTROLLER_MANAGER_STOP
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
restart | force-reload)
|
||||
fail_unless_root
|
||||
log_daemon_message "Restarting $KUBE_CONTROLLER_MANAGER" || true
|
||||
$KUBE_CONTROLLER_MANAGER_STOP
|
||||
$KUBE_CONTROLLER_MANAGER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$KUBE_CONTROLLER_MANAGER_PIDFILE" "$KUBE_CONTROLLER_MANAGER" "$KUBE_CONTROLLER_MANAGER_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
99
cluster/ubuntu-cluster/initd_scripts/kube-proxy
Executable file
99
cluster/ubuntu-cluster/initd_scripts/kube-proxy
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kube-proxy
|
||||
# Required-Start: $etcd
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: Start kube-proxy service
|
||||
# Description:
|
||||
# http://www.github.com/GoogleCloudPlatform/Kubernetes
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin:
|
||||
|
||||
BASE=$(basename $0)
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/kube-proxy)
|
||||
KUBE_PROXY=/opt/bin/$BASE
|
||||
# This is the pid file managed by kube-proxy itself
|
||||
KUBE_PROXY_PIDFILE=/var/run/$BASE.pid
|
||||
KUBE_PROXY_LOGFILE=/var/log/$BASE.log
|
||||
KUBE_PROXY_OPTS=""
|
||||
KUBE_PROXY_DESC="Kube-Proxy"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it)
|
||||
if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
|
||||
log_failure_msg "$KUBE_PROXY_DESC is managed via upstart, try using service $BASE $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check kube-proxy is present
|
||||
if [ ! -x $KUBE_PROXY ]; then
|
||||
log_failure_msg "$KUBE_PROXY not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$KUBE_PROXY_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
KUBE_PROXY_START="start-stop-daemon \
|
||||
--start \
|
||||
--background \
|
||||
--quiet \
|
||||
--exec $KUBE_PROXY \
|
||||
--make-pidfile --pidfile $KUBE_PROXY_PIDFILE \
|
||||
-- $KUBE_PROXY_OPTS \
|
||||
>> $KUBE_PROXY_LOGFILE 2>&1"
|
||||
|
||||
KUBE_PROXY_STOP="start-stop-daemon \
|
||||
--stop \
|
||||
--pidfile $KUBE_PROXY_PIDFILE"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
log_begin_msg "Starting $KUBE_PROXY_DESC: $BASE"
|
||||
$KUBE_PROXY_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBE_PROXY_DESC: $BASE"
|
||||
$KUBE_PROXY_STOP
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
restart | force-reload)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBE_PROXY_DESC: $BASE"
|
||||
$KUBE_PROXY_STOP
|
||||
$KUBE_PROXY_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$KUBE_PROXY_PIDFILE" "$KUBE_PROXY" "$KUBE_PROXY_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
99
cluster/ubuntu-cluster/initd_scripts/kube-scheduler
Executable file
99
cluster/ubuntu-cluster/initd_scripts/kube-scheduler
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kube-scheduler
|
||||
# Required-Start: $etcd
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: Start kube-proxy service
|
||||
# Description:
|
||||
# http://www.github.com/GoogleCloudPlatform/Kubernetes
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin:
|
||||
|
||||
BASE=$(basename $0)
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/kube-scheduler)
|
||||
KUBE_SCHEDULER=/opt/bin/$BASE
|
||||
# This is the pid file managed by kube-scheduler itself
|
||||
KUBE_SCHEDULER_PIDFILE=/var/run/$BASE.pid
|
||||
KUBE_SCHEDULER_LOGFILE=/var/log/$BASE.log
|
||||
KUBE_SCHEDULER_OPTS=""
|
||||
KUBE_SCHEDULER_DESC="Kube-Scheduler"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it)
|
||||
if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
|
||||
log_failure_msg "$KUBE_SCHEDULER_DESC is managed via upstart, try using service $BASE $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check kube-scheduler is present
|
||||
if [ ! -x $KUBE_SCHEDULER ]; then
|
||||
log_failure_msg "$KUBE_SCHEDULER not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$KUBE_SCHEDULER_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
KUBE_SCHEDULER_START="start-stop-daemon \
|
||||
--start \
|
||||
--background \
|
||||
--quiet \
|
||||
--exec $KUBE_SCHEDULER \
|
||||
--make-pidfile --pidfile $KUBE_SCHEDULER_PIDFILE \
|
||||
-- $KUBE_SCHEDULER_OPTS \
|
||||
>> $KUBE_SCHEDULER_LOGFILE 2>&1"
|
||||
|
||||
KUBE_SCHEDULER_STOP="start-stop-daemon \
|
||||
--stop \
|
||||
--pidfile $KUBE_SCHEDULER_PIDFILE"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
log_begin_msg "Starting $KUBE_SCHEDULER_DESC: $BASE"
|
||||
$KUBE_SCHEDULER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBE_SCHEDULER_DESC: $BASE"
|
||||
$KUBE_SCHEDULER_STOP
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
restart | force-reload)
|
||||
fail_unless_root
|
||||
log_begin_msg "Restarting $KUBE_SCHEDULER_DESC: $BASE"
|
||||
$KUBE_SCHEDULER_STOP
|
||||
$KUBE_SCHEDULER_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$KUBE_SCHEDULER_PIDFILE" "$KUBE_SCHEDULER" "$KUBE_SCHEDULER_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
99
cluster/ubuntu-cluster/initd_scripts/kubelet
Executable file
99
cluster/ubuntu-cluster/initd_scripts/kubelet
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kubelet
|
||||
# Required-Start: $etcd
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description: Start kubelet service
|
||||
# Description:
|
||||
# http://www.github.com/GoogleCloudPlatform/Kubernetes
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin:
|
||||
|
||||
BASE=$(basename $0)
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/kube-apiserver)
|
||||
KUBELET=/opt/bin/$BASE
|
||||
# This is the pid file managed by kube-apiserver itself
|
||||
KUBELET_PIDFILE=/var/run/$BASE.pid
|
||||
KUBELET_LOGFILE=/var/log/$BASE.log
|
||||
KUBELET_OPTS=""
|
||||
KUBELET_DESC="Kube-Apiserver"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it)
|
||||
if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
|
||||
log_failure_msg "$KUBELET_DESC is managed via upstart, try using service $BASE $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check kube-apiserver is present
|
||||
if [ ! -x $KUBELET ]; then
|
||||
log_failure_msg "$KUBELET not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$KUBELET_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
KUBELET_START="start-stop-daemon \
|
||||
--start \
|
||||
--background \
|
||||
--quiet \
|
||||
--exec $KUBELET \
|
||||
--make-pidfile --pidfile $KUBELET_PIDFILE \
|
||||
-- $KUBELET_OPTS \
|
||||
>> $KUBELET_LOGFILE 2>&1"
|
||||
|
||||
KUBELET_STOP="start-stop-daemon \
|
||||
--stop \
|
||||
--pidfile $KUBELET_PIDFILE"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
log_begin_msg "Starting $KUBELET_DESC: $BASE"
|
||||
$KUBELET_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBELET_DESC: $BASE"
|
||||
$KUBELET_STOP
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
restart | force-reload)
|
||||
fail_unless_root
|
||||
log_begin_msg "Stopping $KUBELET_DESC: $BASE"
|
||||
$KUBELET_STOP
|
||||
$KUBELET_START
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$KUBELET_PIDFILE" "$KUBELET" "$KUBELET_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user