This repo contains IaC scripts to quickly bootstrap an environemnt in Azure, with one master and two worker nodes, ready for the kubeadm lab.
All three VMs are created with equal resources: Standard_D2as_v4 tier of Ubuntu 18.04-LTS.
Note: Remeber to stop the VMs when not used.
To deploy resource in terraform:
> terraform init
> terraform plan -out res.tfplan
> terraform apply res.tfplan
- Powershell to stop all VMs
- DIY jumpbox to replace Azure Bastion
[ ] Ansible to stop all VMs - Blocked by Ansible issue with Azure Cloud Shell- Check port requirements for NSG during the kubeadm lab
Note: All VMs means master and nodes.
Establish SSH connection to master and nodes VMs using jumpbox. eg. using putty to create 3 sessions.
sudo apt-get update
sudo apt install docker.io -y
sudo systemctl enable docker
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
sudo apt install -y kubeadm=1.18.1-00 kubelet=1.18.1-00 kubectl=1.18.1-00
sudo kubeadm init --kubernetes-version=1.18.1
Keep the generated command: eg.
kubeadm join 10.0.0.4:6443 --token t299v2.c8vcbm33kfi1x0nt \
--discovery-token-ca-cert-hash sha256:a5b1372829885851ca72ec1502414460c2ed5124e83704c8c07b3d49b137a229
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
sudo kubeadm join 10.0.0.4:6443 --token t299v2.c8vcbm33kfi1x0nt \
--discovery-token-ca-cert-hash sha256:a5b1372829885851ca72ec1502414460c2ed5124e83704c8c07b3d49b137a229
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
[watch] kubectl get nodes
[watch] kubectl get pods --all-namespaces