Last active
March 3, 2017 11:57
-
-
Save jonathan-kosgei/d9efafaa7fefae60bd94d0d56cb52ead to your computer and use it in GitHub Desktop.
Installing Calico for Docker Networking
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/sh | |
# Setup Calico for Docker on Ubuntu 16.04 | |
# Change to the internal ip of your node | |
NODE_IP=ip route get 8.8.8.8 | awk '{print $NF; exit}' | |
# Install docker | |
sudo apt-get install -y --no-install-recommends \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - | |
sudo add-apt-repository \ | |
"deb https://apt.dockerproject.org/repo/ \ | |
ubuntu-$(lsb_release -cs) \ | |
main testing" | |
sudo apt-get update | |
sudo apt-get -y install docker-engine=1.13.1~ubuntu-xenial | |
# Setup etcd | |
docker run --name etcd1 -d -p 2379:2379 jkosgei/etcd -advertise-client-urls http://${NODE_IP}:2379 -listen-client-urls http://0.0.0.0:2379 | |
# Download calicoctl | |
wget -O /usr/local/bin http://www.projectcalico.org/latest/calicoctl | |
chmod +x /usr/local/bin/calicoctl | |
# Run calicoctl on this node | |
ETCD_ENDPOINTS=http://${NODE_IP}:2379 calicoctl node run --no-default-ippools --ip=${NODE_IP} | |
# Setup 10.0.0.0/8 pool | |
cat << EOF | ETCD_ENDPOINTS=http://${NODE_IP}:2379 calicoctl create -f - | |
- apiVersion: v1 | |
kind: ipPool | |
metadata: | |
cidr: 10.0.0.0/8 | |
EOF | |
# Check status | |
ETCD_ENDPOINTS=http://${NODE_IP}:2379 calicoctl get ipPool | |
ETCD_ENDPOINTS=http://${NODE_IP}:2379 calicoctl status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment