Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Weave support #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions init-master.bash
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
#!/bin/bash
#
# Usage: sudo -E ./init-master.bash [pod_network_type]
#
set -e

# Read Pod Network type from first arg (default to Flannel)
POD_NETWORK="${1:-flannel}"

kubeadm init --pod-network-cidr=10.244.0.0/16

# By now the master node should be ready!
mkdir -p $HOME/.kube
cp --remove-destination /etc/kubernetes/admin.conf $HOME/.kube/config
chown ${SUDO_UID} $HOME/.kube/config

# Install flannel
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml
if [ "$POD_NETWORK" == "flannel" ]; then
# Install flannel
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml
elif [ "$POD_NETWORK" == "weave" ]; then
# Install weave
# From https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/
sysctl net.bridge.bridge-nf-call-iptables=1
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
else
echo "Unsupported pod network: $POD_NETWORK"
echo "Please choose a supported network type from one of the following: flannel weave"
exit 1
fi


# Make master node a running worker node too!
# FIXME: Use taint tolerations instead in the future
Expand Down