Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathan-kosgei/d9efafaa7fefae60bd94d0d56cb52ead to your computer and use it in GitHub Desktop.
Save jonathan-kosgei/d9efafaa7fefae60bd94d0d56cb52ead to your computer and use it in GitHub Desktop.
Installing Calico for Docker Networking
#!/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