Skip to content

Commit

Permalink
Deploy Calico pod network plugin on k8s-1.17
Browse files Browse the repository at this point in the history
Flannel has compatability issues with k8s-1.17 flannel-io/flannel#1245.
deploy calico plugin instead also for better proformance.

Signed-off-by: Or Mergi <[email protected]>
  • Loading branch information
Or Mergi committed Jan 29, 2020
1 parent db3913a commit 5736c96
Show file tree
Hide file tree
Showing 3 changed files with 814 additions and 11 deletions.
14 changes: 9 additions & 5 deletions cluster-provision/k8s/scripts/node01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ done

kubeadm init --config /etc/kubernetes/kubeadm.conf

pod_cird="10.244.0.0/16"
version=`kubectl version --short --client | cut -d":" -f2 |sed 's/ //g' | cut -c2- | cut -d"." -f2`
flannel_manifest="/tmp/flannel.yaml"
if [[ $version -ge "16" ]]; then
flannel_manifest="/tmp/flannel-ge-16.yaml"
network_plugin_manifest="/tmp/flannel.yaml"
if [[ $version -ge "17" ]]; then
network_plugin_manifest="/tmp/calico.yaml"
sed -i -e "s?192.168.0.0/16?$pod_cird?g" "$network_plugin_manifest"
elif [[ $version -ge "16" ]]; then
network_plugin_manifest="/tmp/flannel-ge-16.yaml"
elif [[ $version -ge "12" ]]; then
flannel_manifest="/tmp/flannel-ge-12.yaml"
network_plugin_manifest="/tmp/flannel-ge-12.yaml"
fi
kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$flannel_manifest"
kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$network_plugin_manifest"

kubectl --kubeconfig=/etc/kubernetes/admin.conf taint nodes node01 node-role.kubernetes.io/master:NoSchedule-

Expand Down
18 changes: 12 additions & 6 deletions cluster-provision/k8s/scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,20 @@ sysctl --system
echo bridge >> /etc/modules
echo br_netfilter >> /etc/modules

kubeadm init --pod-network-cidr=10.244.0.0/16 --kubernetes-version v${version} --token abcdef.1234567890123456
flannel_manifest="/tmp/flannel.yaml"
if [[ $minor_version -ge "16" ]]; then
flannel_manifest="/tmp/flannel-ge-16.yaml"
pod_cird="10.244.0.0/16"
kubeadm init --pod-network-cidr=$pod_cird --kubernetes-version v${version} --token abcdef.1234567890123456

network_plugin_manifest="/tmp/flannel.yaml"
if [[ $minor_version -ge "17" ]]; then
network_plugin_manifest="/tmp/calico.yaml"
sed -i -e "s?192.168.0.0/16?$pod_cird?g" "$network_plugin_manifest"
elif [[ $minor_version -ge "16" ]]; then
network_plugin_manifest="/tmp/flannel-ge-16.yaml"
elif [[ $minor_version -ge "12" ]]; then
flannel_manifest="/tmp/flannel-ge-12.yaml"
network_plugin_manifest="/tmp/flannel-ge-12.yaml"
fi
kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$flannel_manifest"

kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$network_plugin_manifest"

# Wait at least for 7 pods
while [[ "$(kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system --no-headers | wc -l)" -lt 7 ]]; do
Expand Down
Loading

0 comments on commit 5736c96

Please sign in to comment.