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 init
To 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/config
If you are a root user, you can run the following command:
export KUBECONFIG=/etc/kubernetes/admin.conf
To set up the container network interface (CNI), apply the following YAML:
kubectl apply -f https://reweave.azurewebsites.net/k8s/v1.30/net.yaml
To 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.