Last active
April 20, 2021 18:39
-
-
Save dbathgate/737e8d800decde9adbf8a0130870bcc4 to your computer and use it in GitHub Desktop.
Basic flannel and etcd setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
###### Install and run Etcd ############# | |
curl --location https://github.com/coreos/etcd/releases/download/v3.1.5/etcd-v3.1.5-linux-amd64.tar.gz | tar -xz | |
cp etcd-v3.1.5-linux-amd64/etcd /usr/local/bin/ | |
cp etcd-v3.1.5-linux-amd64/etcdctl /usr/local/bin/ | |
mkdir /var/lib/etcd | |
nohup etcd --data-dir=/var/lib/etcd/ --listen-client-urls=http://192.168.33.11:2379 --advertise-client-urls=http://192.168.33.11:2379 </dev/null >/dev/null 2>&1 & | |
######################################## | |
#### Configure network ################# | |
etcdctl --endpoint http://192.168.33.11:2379 set /coreos.com/network/config '{ "Network": "10.2.0.0/16", "Backend": { "Type": "vxlan" } }' | |
######################################## | |
#### Install and run Flannel ############ | |
curl --location https://github.com/coreos/flannel/releases/download/v0.7.0/flanneld-amd64 -o /usr/local/bin/flanneld | |
chmod +x /usr/local/bin/flanneld | |
nohup flanneld --ip-masq=true --etcd-endpoints=http://192.168.33.11:2379 --public-ip=192.168.33.11 </dev/null >/dev/null 2>&1 & | |
######################################## | |
#### Configure Docker ################## | |
cat >> /etc/sysconfig/docker <<EOF | |
# Flannel config | |
. /run/flannel/subnet.env | |
OPTIONS="\$OPTIONS --bip=\$FLANNEL_SUBNET --mtu=\$FLANNEL_MTU" | |
EOF | |
/etc/init.d/docker stop | |
/etc/init.d/docker start | |
######################################## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, very good, I have 2 doubts, the first is that I use debian and do not have the / etc / sysconfig / docker folder, should I put it in / etc / default / docker?
Another question is that when I restart the machine the network is lost what do I have to do?