3 # For host setup as Kubernetes master
5 POD_NETWORK_CIDR=${2:-192.168.0.0/16}
6 SERVICE_CIDR=${3:-172.16.1.0/24}
8 if [ -z "${MGMT_IP}" ]; then
9 echo "Please specify a management IP!"
13 if ! kubectl get nodes; then
14 sudo kubeadm config images pull
16 --pod-network-cidr="${POD_NETWORK_CIDR}" \
17 --apiserver-advertise-address="${MGMT_IP}" \
18 --service-cidr="${SERVICE_CIDR}"
20 if [ "$(id -u)" = 0 ]; then
21 echo "export KUBECONFIG=/etc/kubernetes/admin.conf" | \
22 tee -a "${HOME}/.profile"
23 # shellcheck disable=SC1090
24 source "${HOME}/.profile"
26 mkdir -p "${HOME}/.kube"
27 sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config"
28 sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config"