/kubernetes-the-ansible-way

Bootstrap a Kubernetes cluster from scratch, the Ansible way.

Primary LanguageJinjaGNU General Public License v3.0GPL-3.0

🚀 Kubernetes The Ansible Way

Deploy a Kubernetes cluster from scratch using Vagrant and Ansible. This project is based on the kubernetes-the-hard-way repository and uses Ansible to perform all the tasks required, from creating and signing certificates for different components, setting up nodes by adding proper kernel modules, downloading Kubernetes components binaries and adding DNS entries for each node, generating kubeconfigs, installing container runtime containerd, and configuring cluster networking and internal DNS.

📋 Table of Contents

🎥 Demo Video

Watch the video

📖 Introduction

Kubernetes the Ansible way is a project designed to simplify the process of deploying a Kubernetes cluster using Ansible and Vagrant. It automates the steps outlined in the Kubernetes the hard way guide, making it easier for you to set up a Kubernetes cluster from scratch.

🏗️ Architecture

Component IP Address Description
controlplane01 192.168.56.11 Control Plane Node 1
controlplane02 192.168.56.12 Control Plane Node 2
loadbalancer 192.168.56.30 Load Balancer
node01 192.168.56.21 Worker Node 1
node02 192.168.56.22 Worker Node 2

🚀 Get Started

Prerequisites

Ensure you have the following tools installed on your system:

Usage

Clone the repository and navigate into the directory:

git clone https://github.com/0xzer0x/kubernetes-the-ansible-way
cd kubernetes-the-ansible-way
vagrant up

This will deploy the entire Kubernetes cluster, including:

  • 🖥️ Setting up nodes with proper kernel modules
  • 🔒 Creating and signing certificates for different components
  • 📦 Downloading Kubernetes components binaries
  • 🌐 Adding DNS entries for each node
  • 🗂️ Generating kubeconfigs
  • 🐳 Installing the container runtime containerd
  • 📡 Configuring cluster networking with Flannel
  • 🌐 Setting up internal DNS with CoreDNS

🛠️ Technologies Used

  • Vagrant: Tool for managing virtual machine environments.
  • Ansible: Automation tool for configuration management and application deployment.
  • HAProxy: High availability load balancer for efficient traffic distribution.
  • Containerd: Core container runtime used in container orchestration.
  • Flannel: Lightweight network fabric designed for Kubernetes.
  • CoreDNS: DNS server for Kubernetes internal DNS resolution.

🌟 Acknowledgements

Special thanks to kubernetes-the-hard-way for providing the foundational steps and guidance used in creating this project.

📜 License

This project is licensed under the GPL v3 License. See the LICENSE file for details.