Git Product home page Git Product logo

ha-kuber-kubespray-vagrant's Introduction

Full Automate HA Kubernetes Environment with Vagrant and Kubespray

Kubernetes Cluster Architecture

Introduction

This repository provides a fully automated setup for a highly available Kubernetes (K8s) environment using Vagrant and Kubespray. It provisions a Kubernetes cluster with multiple master nodes, a load balancer, and worker nodes using VirtualBox as the provider and Ubuntu 22.04.3 "Jammy Jellyfish" as the base OS. This setup is intended for development and testing purposes.

Prerequisites

Before you begin, ensure your system meets the following requirements:

  • Ubuntu-based operating system with at least 8 CPU cores and 16GB RAM.
  • Essential applications: VirtualBox and Vagrant.

Installing VirtualBox and Vagrant

To run this script on an Ubuntu-based operating system:

  1. Open a terminal.

  2. Update your package index:

    sudo apt update
  3. Install VirtualBox:

    sudo apt install virtualbox
  4. Download and install Vagrant from the official website or using the following command:

    sudo apt install vagrant

For other operating systems, refer to the official Vagrant documentation for installation instructions.

Usage

  1. Clone this repository to your local machine:

    git clone https://github.com/tadbiri/HA-Kuber-kubespray-vagrant.git
  2. Navigate to the directory containing the Vagrantfile:

    cd HA-Kuber-kubespray-vagrant
  3. Edit the control.rb file to adjust the number of nodes, CPU, memory, and IP configurations as needed.

  4. Run the following command to start the VMs and provision the Kubernetes cluster:

    vagrant up
  5. Once the provisioning is complete, log into the load balancer node:

    vagrant ssh kube-lb-1
  6. Run the post setup script to complete the cluster setup:

    sudo /root/post_setup.sh

Useful Vagrant Commands

Here are some useful Vagrant commands to manage your VMs:

  • Halt all running VMs:

    vagrant halt
  • Reload all VMs (useful after changing the Vagrantfile):

    vagrant reload
  • Destroy all VMs:

    vagrant destroy -f
  • SSH into a specific VM:

    vagrant ssh <vm_name>
  • Check the status of VMs:

    vagrant status

Files Description

Vagrantfile

The Vagrantfile defines the configuration for creating and provisioning the virtual machines. It sets up master nodes, worker nodes, and load balancers, and configures their CPU, memory, and network settings.

control.rb

The control.rb file contains variables to control the number of master, worker, and load balancer nodes, as well as their CPU, memory, and IP configurations.

bootstrap.sh

The bootstrap.sh script is executed during the provisioning phase of each VM. It installs essential packages, enables root login, and sets up SSH keys for secure communication between nodes.

post_setup.sh

The post_setup.sh script performs additional configuration after the initial setup. It installs necessary packages, configures HAProxy, clones the Kubespray repository, and runs Ansible playbooks to set up the Kubernetes cluster. This script must be run manually on the load balancer node after the VMs are up.

For more detailed descriptions and usage instructions of each script, refer to the respective README files in this repository.

Notes

  • This setup is intended for development and testing purposes only and may not be suitable for production environments.
  • Ensure that your system meets the hardware requirements specified in the control file to avoid performance issues.
  • Internet access is enabled by default for all VMs to facilitate package installation and updates.

Additional Information

For further details on each script and its functionality, refer to the individual README files linked below:

By following the instructions and utilizing the provided scripts, you can efficiently set up a fully automated HA Kubernetes environment for your development and testing needs.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Contact

For any questions or issues, please open a GitHub issue in this repository.

ha-kuber-kubespray-vagrant's People

Contributors

tadbiri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.