This script automates the setup of a Kubernetes cluster without the default kube-proxy, using Cilium (eBPF) instead, and includes configurations for Kubeadm, Containerd, Helm, OpenEBS (optional), and Prometheus (optional) monitoring.
To utilize this script:
-
Ensure your machine meets the prerequisites: Ubuntu or similar Linux distribution, with root or sudo privileges.
-
Make the script executable.
-
Run the script with root privileges:
chmod +x cluster_script.sh sudo ./cluster_script.sh
-
Follow the interactive prompts to choose between
AGENTorSERVERinstallation and input necessary details.
Requires input for:
- Cluster Name: Name of the Kubernetes cluster. (essential for cilium clustermesh)
- Cluster ID: Numeric identifier for the cluster. (essential for cilium clustermesh)
- Pod Subnet (Pod CIDR): Subnet for pod networking.
- Service Subnet (Service IP): Subnet for service networking.
Sets up a Kubernetes master node. After installation, execute the following commands to configure kubectl for use without sudo privileges:
mkdir -p $HOME/.kube
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/configAt the end of the SERVER installation, a token is generated and saved in the join_worker.sh file. This token is used to join worker nodes to the cluster at the end of the AGENT installation.
Prepares a Kubernetes worker node. Use the token generated in the join_worker.sh file from the SERVER installation to join the cluster.
install_pre(): Installs system prerequisites.install_docker(): Installs Docker.containerd_systemd_service(): Configures containerd.install_kubeadm(): Installs kubeadm.init_kubeadm(): Initializes kubeadm without kube-proxy.kube_config_dir(): Sets up Kubernetes config directory.install_helm(): Installs Helm.untaint_control_plane_node(): Untaints control plane node.install_k8s_storageclass(): Installs OpenEBS storage class (optional).install_cilium(): Installs Cilium CNI.install_hubble(): Installs Hubble.install_prometheus(): Installs Prometheus (optional).is_valid_cidr(): Validates CIDR format.
For more detailed information about each component and their role in Kubernetes, refer to the official documentation of Kubernetes, Helm, Cilium, OpenEBS, and Prometheus.
This initial script, as developed within Assist-IoT project, was provided by Rafael Vaño Garcia (UPV). Updates, enhancements and adaptations to aerOS needs were made by Vasilis Pitsilis and Andreas Sakellaropoulos.
For any inquiries or issues related to this script, please contact Andreas Sakellaropoulos at [email protected].
This script is released under the Apache 2.0 License. See the LICENSE file for more details.