This shell script sets up a Kubernetes Master node on a physical machine running Ubuntu 22.04 LTS. It installs all required dependencies, configures the system, and initializes a Kubernetes cluster.
-
Download the Script
- Save the script
-
Make it Executable
- Run this command:
chmod +x <file>.sh
- Run this command:
-
Run the Script
- Execute it with
sudo:sudo ./<file>.sh - Follow the prompts to confirm or enter the Master node IP.
- Execute it with
-
Check the Results
- After completion, check the cluster status:
kubectl get nodes - View the log file if there are issues:
cat kubeadm_init.log - Find the Worker node join command:
cat k8s-join-command.txt
- After completion, check the cluster status:
kubeadm_init.log: Log of the Kubernetes initialization process.k8s-join-command.txt: Command to join Worker nodes to the cluster.
- Kubernetes Version: Edit
K8S_VERSIONin the script (e.g.,1.29.2-1.1). - Pod Network: Change
POD_CIDRif needed (default is10.244.0.0/16).
- If the IP detection fails, manually enter the correct IP when prompted.
- For hardware errors, ensure your machine meets the minimum requirements.