Skip to content

Commit

Permalink
ubuntu getting started guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipin Jain committed Dec 15, 2014
1 parent 5523e03 commit cf24c77
Show file tree
Hide file tree
Showing 21 changed files with 936 additions and 0 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ least one maintainer on relevant issues and PRs.
* Local: [Derek Carr](https://github.com/derekwaynecarr)
* Vagrant: [Derek Carr](https://github.com/derekwaynecarr)
* CloudStack: [Sebastien Goasguen](https://github.com/runseb)
* Ubuntu: [Vipin Jain](https://github.com/jainvipin)
9 changes: 9 additions & 0 deletions cluster/ubuntu/default_scripts/etcd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Etcd Upstart and SysVinit configuration file

# Customize etcd location
# ETCD="/opt/bin/etcd"

# Use ETCD_OPTS to modify the start/restart options
ETCD_OPTS="-listen-client-urls=http://127.0.0.1:4001"

# Add more envionrment settings used by etcd here
13 changes: 13 additions & 0 deletions cluster/ubuntu/default_scripts/kube-apiserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Kube-Apiserver Upstart and SysVinit configuration file

# Customize kube-apiserver binary location
# KUBE_APISERVER="/opt/bin/kube-apiserver"

# Use KUBE_APISERVER_OPTS to modify the start/restart options
KUBE_APISERVER_OPTS="--address=127.0.0.1 \
--port=8080 \
--etcd_servers=http://127.0.0.1:4001 \
--logtostderr=true \
--portal_net=11.1.1.0/24"

# Add more envionrment settings used by kube-apiserver here
11 changes: 11 additions & 0 deletions cluster/ubuntu/default_scripts/kube-controller-manager
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Kube-Controller-Manager Upstart and SysVinit configuration file

# Customize kube-controller-manager binary location
# KUBE_CONTROLLER_MANAGER="/opt/bin/kube-controller-manager"

# Use KUBE_CONTROLLER_MANAGER_OPTS to modify the start/restart options
KUBE_CONTROLLER_MANAGER_OPTS="--master=127.0.0.1:8080 \
--machines=127.0.0.1 \
--logtostderr=true"

# Add more envionrment settings used by kube-controller-manager here
10 changes: 10 additions & 0 deletions cluster/ubuntu/default_scripts/kube-proxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Kube-Proxy Upstart and SysVinit configuration file

# Customize kube-proxy binary location
# KUBE_PROXY="/opt/bin/kube-proxy"

# Use KUBE_PROXY_OPTS to modify the start/restart options
KUBE_PROXY_OPTS="--etcd_servers=http://127.0.0.1:4001 \
--logtostderr=true"

# Add more envionrment settings used by kube-apiserver here
10 changes: 10 additions & 0 deletions cluster/ubuntu/default_scripts/kube-scheduler
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Kube-Scheduler Upstart and SysVinit configuration file

# Customize kube-apiserver binary location
# KUBE_SCHEDULER="/opt/bin/kube-apiserver"

# Use KUBE_SCHEDULER_OPTS to modify the start/restart options
KUBE_SCHEDULER_OPTS="--logtostderr=true \
--master=127.0.0.1:8080"

# Add more envionrment settings used by kube-scheduler here
13 changes: 13 additions & 0 deletions cluster/ubuntu/default_scripts/kubelet
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Kubelet Upstart and SysVinit configuration file

# Customize kubelet binary location
# KUBELET="/opt/bin/kubelet"

# Use KUBELET_OPTS to modify the start/restart options
KUBELET_OPTS="--address=127.0.0.1 \
--port=10250 \
--hostname_override=127.0.0.1 \
--etcd_servers=http://127.0.0.1:4001 \
--logtostderr=true"

# Add more envionrment settings used by kube-scheduler here
31 changes: 31 additions & 0 deletions cluster/ubuntu/init_conf/etcd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
description "Etcd service"
author "@jainvipin"

# start after docker starts, stop before docker stops
start on started docker
stop on stopping docker

respawn

pre-start script
# see also https://github.com/jainvipin/kubernetes-ubuntu-start
ETCD=/opt/bin/$UPSTART_JOB
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if [ -f $ETCD ]; then
exit 0
fi
echo "$ETCD binary not found, exiting"
exit 22
end script

script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
ETCD=/opt/bin/$UPSTART_JOB
ETCD_OPTS=""
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
exec "$ETCD" $ETCD_OPTS
end script
30 changes: 30 additions & 0 deletions cluster/ubuntu/init_conf/kube-apiserver.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
description "Kube-Apiserver service"
author "@jainvipin"

# start in conjunction with etcd
start on started etcd
stop on stopping etcd

# respawn

pre-start script
# see also https://github.com/jainvipin/kubernetes-start
KUBE_APISERVER=/opt/bin/$UPSTART_JOB
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if [ -f $KUBE_APISERVER ]; then
exit 0
fi
exit 22
end script

script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
KUBE_APISERVER=/opt/bin/$UPSTART_JOB
KUBE_APISERVER_OPTS=""
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
exec "$KUBE_APISERVER" $KUBE_APISERVER_OPTS
end script
30 changes: 30 additions & 0 deletions cluster/ubuntu/init_conf/kube-controller-manager.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
description "Kube-Controller-Manager service"
author "@jainvipin"

# start in conjunction with etcd
start on started etcd
stop on stopping etcd

# respawn

pre-start script
# see also https://github.com/jainvipin/kubernetes-ubuntu-start
KUBE_CONTROLLER_MANAGER=/opt/bin/$UPSTART_JOB
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if [ -f $KUBE_CONTROLLER_MANAGER ]; then
exit 0
fi
exit 22
end script

script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
KUBE_CONTROLLER_MANAGER=/opt/bin/$UPSTART_JOB
KUBE_CONTROLLER_MANAGER_OPTS=""
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
exec "$KUBE_CONTROLLER_MANAGER" $KUBE_CONTROLLER_MANAGER_OPTS
end script
30 changes: 30 additions & 0 deletions cluster/ubuntu/init_conf/kube-proxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
description "Kube-Proxy service"
author "@jainvipin"

# start in conjunction with etcd
start on started etcd
stop on stopping etcd

# respawn

pre-start script
# see also https://github.com/jainvipin/kubernetes-start
KUBE_PROXY=/opt/bin/$UPSTART_JOB
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if [ -f $KUBE_PROXY ]; then
exit 0
fi
exit 22
end script

script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
KUBE_PROXY=/opt/bin/$UPSTART_JOB
KUBE_PROXY_OPTS=""
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
exec "$KUBE_PROXY" $KUBE_PROXY_OPTS
end script
30 changes: 30 additions & 0 deletions cluster/ubuntu/init_conf/kube-scheduler.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
description "Kube-Scheduler service"
author "@jainvipin"

# start in conjunction with etcd
start on started etcd
stop on stopping etcd

# respawn

pre-start script
# see also https://github.com/jainvipin/kubernetes-start
KUBE_SCHEDULER=/opt/bin/$UPSTART_JOB
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if [ -f $KUBE_SCHEDULER ]; then
exit 0
fi
exit 22
end script

script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
KUBE_SCHEDULER=/opt/bin/$UPSTART_JOB
KUBE_SCHEDULER_OPTS=""
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
exec "$KUBE_SCHEDULER" $KUBE_SCHEDULER_OPTS
end script
30 changes: 30 additions & 0 deletions cluster/ubuntu/init_conf/kubelet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
description "Kubelet service"
author "@jainvipin"

# start in conjunction with etcd
start on started etcd
stop on stopping etcd

# respawn

pre-start script
# see also https://github.com/jainvipin/kubernetes-ubuntu-start
KUBELET=/opt/bin/$UPSTART_JOB
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if [ -f $KUBELET ]; then
exit 0
fi
exit 22
end script

script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
KUBELET=/opt/bin/$UPSTART_JOB
KUBELET_OPTS=""
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
exec "$KUBELET" $KUBELET_OPTS
end script
100 changes: 100 additions & 0 deletions cluster/ubuntu/initd_scripts/etcd
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit cf24c77

Please sign in to comment.