Minor enhancement to kubernetes install script

Specify correct pod CIDR and enable cni for kubelet

Change-Id: I550b7c60901fd87fb43ff1abc2f8179f6367a6b7
This commit is contained in:
Kostiantyn Kalynovskyi 2021-01-12 17:10:28 -06:00
parent 1df9ba7978
commit 89e8c7b5c4

View File

@ -1,10 +1,13 @@
#!/bin/bash
set -ex
: ${KUBE_VERSION:="v1.19.2"}
: ${MINIKUBE_VERSION:="v1.16.0"}
: ${UPSTREAM_DNS_SERVER:="8.8.4.4"}
: ${DNS_DOMAIN:="cluster.local"}
: ${CALICO_VERSION:="v3.17"}
: ${CNI_MANIFEST_PATH:="/tmp/calico.yaml"}
export DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND=noninteractive
@ -34,6 +37,11 @@ sudo -E apt-get install -y \
sudo mkdir -p /data
sudo mount -t tmpfs -o size=512m tmpfs /data
# Download calico manifest
if [ ! -f "$CNI_MANIFEST_PATH" ]; then
curl -Ss https://docs.projectcalico.org/"${CALICO_VERSION}"/manifests/calico.yaml -o ${CNI_MANIFEST_PATH}
fi
# Install minikube and kubectl
URL="https://storage.googleapis.com"
sudo -E curl -sSLo /usr/local/bin/minikube "${URL}"/minikube/releases/"${MINIKUBE_VERSION}"/minikube-linux-amd64
@ -51,11 +59,17 @@ sudo -E minikube start \
--driver=none \
--wait=apiserver,system_pods,node_ready \
--wait-timeout=6m0s \
--network-plugin=cni \
--cni=${CNI_MANIFEST_PATH} \
--extra-config=kube-proxy.mode=ipvs \
--extra-config=controller-manager.allocate-node-cidrs=true \
--extra-config=controller-manager.cluster-cidr=192.168.0.0/16 \
--extra-config=kubeadm.pod-network-cidr=192.168.0.0/16 \
--extra-config=kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
kubectl get nodes -o wide
kubectl get pod -A
cat <<EOF | kubectl replace -f -
apiVersion: v1
data:
@ -86,11 +100,5 @@ metadata:
namespace: kube-system
EOF
# Use tigera to deploy calico
kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml
kubectl get nodes -o wide
kubectl get pod -A
kubectl wait --for=condition=Ready pods --all -A --timeout=180s