#!/usr/bin/env bash echo "Setting up a Kubernetes Master Host" echo "Parameters Passed:" echo " constr=$constr" export constr=$constr export DEBIAN_FRONTEND=noninteractive echo "Installing the Prerequisites" sudo apt update sudo apt install -y unzip tree apt-transport-https jq curl wget ./microsoft-prod.list sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/ sudo curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/ sudo apt-get update sudo apt-get install -y moby-engine moby-cli /dev/null | openssl dgst -sha256 -hex | sed 's/^.* //') export token=$(kubeadm token list -o json | jq -r .token) export IPAddress=$(hostname -I | cut -d' ' -f1) clear echo echo echo "Done! you can see the status by running the following command, once you have worker nodes:" echo " kubectl get pods -n iotedge --kubeconfig=/etc/kubernetes/admin.conf" echo "To see the visual UI, run:" echo " sudo k9s -n iotedge --kubeconfig=/etc/kubernetes/admin.conf" echo echo echo "on a worker node, run the following to install Kubernetes:" echo " wget -q -O - https://raw.githubusercontent.com/ksaye/AzureIoTEdgeOnKubernetes/master/workerNode.sh | sudo bash" echo echo "then run the following command to join this cluster:" echo " sudo kubeadm join $IPAddress:6443 --token $token --discovery-token-ca-cert-hash sha256:$tokenHash --ignore-preflight-errors=all"