Skip to content

Commit

Permalink
Deploying Weave net pre lb, expose pod network on lb machines
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik René Høegh committed Apr 1, 2018
1 parent aa9bd49 commit f187ff2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
19 changes: 19 additions & 0 deletions scripts/install-loadbalancer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ echo "Installing loadbalancer..."
echo "Downloading binaries..."
wget -q --timestamping https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/linux/amd64/kubectl &
wget -q --timestamping https://github.com/containous/traefik/releases/download/v1.5.3/traefik_linux-amd64 &
wget -q --timestamping git.io/weave &

mkdir -p /root/ssl

echo "Adding hosts to /etc/hosts file"
cat /tmp/hosts >> /etc/hosts

# Installing Docker on Load balancer
dnf install dnf-plugins-core -y
dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
dnf config-manager --set-disabled docker-ce-edge
dnf install docker-ce -y

# Wait for downloads to complete
wait
echo "Done downloading binaries..."

Expand All @@ -17,7 +25,10 @@ chmod +x kubectl
mv kubectl /usr/bin/
sudo mv traefik_linux-amd64 /root/traefik
sudo chmod u+x /root/traefik
mv weave /usr/bin/weave
chmod a+x /usr/bin/weave

# Create rbac for traefik
echo "Creating rbac file for traefik..."
cat << EOF > /root/traefik.rbac.yaml
apiVersion: v1
Expand Down Expand Up @@ -142,6 +153,14 @@ sudo systemctl daemon-reload
sudo systemctl enable traefik
sudo service traefik start

sudo systemctl enable docker
sudo service docker start

# Install weavenet
WORKER_IPS=$(cat /etc/hosts | grep worker | cut -d " " -f1 | tr '\n' ' ')
/usr/bin/weave launch --ipalloc-init observer $WORKER_IPS --ipalloc-range 20.0.0.0/16
/usr/bin/weave expose

echo "Cleaning up..."
rm -f /tmp/admin-key.pem
rm -f /tmp/admin.pem
Expand Down
8 changes: 8 additions & 0 deletions scripts/install-master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,11 @@ systemctl daemon-reload
systemctl enable kube-apiserver kube-controller-manager kube-scheduler
systemctl start kube-apiserver kube-controller-manager kube-scheduler

# This should be run once only.
# It needs to be run before loadbalancers get ready
# Its a hack...
sleep 10
if [ $(hostname) == "k8s-master-1" ]; then
echo "Deploying WeaveNet..."
/usr/local/bin/kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(/usr/local/bin/kubectl version | base64 | tr -d '\n')&env.IPALLOC_RANGE=20.0.0.0/16"
fi
10 changes: 1 addition & 9 deletions scripts/post_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,5 @@ subjects:
name: kubernetes
EOF

echo "Deploying WeaveNet..."
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')&env.IPALLOC_RANGE=20.0.0.0/16"

#kubever=$(kubectl version | base64 | tr -d '\n')
#kubectl apply -f "https://git.io/weave-kube-1.6"&> ../logs/weavenet.log
#kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever" &> ../logs/weavenet.log

echo "Deploying KubeDNS..."
#kubectl create -f "https://storage.googleapis.com/kubernetes-the-hard-way/kube-dns.yaml" > ../logs/kubedns.log

kubectl apply -f kubedns.yaml > ../logs/kubedns.log

0 comments on commit f187ff2

Please sign in to comment.