To execute the script, follow these steps:
-
Grant execute permissions to the script:
chmod +x kubeadm.sh
-
Run the script:
./kubeadm.sh
After running the script, repeat this steps for each control plane and worker nodes to ensure proper configuration.
After running the script in the control plane node, initialize Kubernetes:
kubeadm initTo start using your cluster, run the commands below:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/configIf you are a root user, you can run the following command:
export KUBECONFIG=/etc/kubernetes/admin.confTo set up the container network interface (CNI), apply the following YAML:
kubectl apply -f https://reweave.azurewebsites.net/k8s/v1.30/net.yamlTo join worker nodes to the cluster, run the kubeadm join command displayed on the control plane node after initialization. The command will look similar to the following:
kubeadm join <control-plane-host>:<port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>Run this command for each worker nodes.
Ensure you copy and run the exact command shown in your terminal output during the kubeadm init process.