Instantly share code, notes, and snippets.

@mihok /flanneld.conf
Last active Jul 28, 2016

Embed
What would you like to do?
Vagrant provision script and Upstart service files to install and run flanneld
description "flanneld Service"
author "Matthew Mihok"
env FLANNELD_HOME=/opt/flanneld-0.5.5
env LOG_HOME=/var/log/flannel
# Make sure network and fs is up, and start in runlevels 2-5
start on (net-device-up
and local-filesystems
and runlevel [2345])
# Stop in runlevels 0,1 and 6
stop on runlevel [016]
# automatically respawn, but if its respwaning too fast (5 times in 60 seconds, don't do that)
respawn
respawn limit 5 60
# make sure node is there, the code directory is there
pre-start script
test -x $FLANNELD_HOME/flanneld || { stop; exit 0; }
end script
# cd to code path and run node, with the right switches
script
export FLANNELD_IFACE="eth1"
export FLANNELD_ETCD_PREFIX="/network"
export FLANNELD_ETCD_ENDPOINTS="http://127.0.0.1:2379"
exec flanneld >> $LOG_HOME/flanneld.log 2>&1
end script
{
"Network": "44.0.0.0/8",
"SubnetLen": 24,
"SubnetMin": "44.1.0.0",
"SubnetMax": "44.10.0.0",
"Backend": {
"Type": "udp"
}
}
#!/bin/bash
set -x;
# Flannel
cd /opt/
# Download the release
curl -L https://github.com/coreos/flannel/releases/download/v0.5.5/flannel-0.5.5-linux-amd64.tar.gz -o flanneld-0.5.5.tar.gz
# Create the directory the binaries will live in
mkdir /opt/flanneld-0.5.5
# Extract the contents of the release
tar -zxvf flanneld-0.5.5.tar.gz -C flanneld-0.5.5 --strip-components=1
# Make symlinks so we can access the binaries
ln -s /opt/flanneld-0.5.5/flanneld /usr/local/bin/flanneld
# Copy our Upstart script
cp /vagrant/flanneld.conf /etc/init/flanneld.conf
# Create flannel's logging directory
mkdir /var/log/flannel
chown vagrant:vagrant /var/log/flannel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment