/vagrant-kubespray

Kubernetes cluster using Vagrant and Kubespray

Primary LanguageShellMIT LicenseMIT

Create Kubernetes Cluster using Kubespray

pre-commit badge Conventional commits badge Keep a Changelog v1.1.0 badge MIT License Badge

This repository will create a Kubernetes Cluster, using Kubespray, so it can be used for a Lab Environment.

It will create 4 VMs:

  • node0[1-3]: 1 k8s master and 2 worker nodes (2 vcpu and 4GB RAM each)
  • controller: controller node (2 vcpu, 2GB RAM)

kubectl binary will be installed on the controller node.

This repository was tested using

Test Env

Quick Start

Lab Environment

Check the variables defined on the .env file.

NOTE: The bootstrap uses the ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub, so if you don't have these files, you need to create using:

ssh-keygen -t rsa

To create the k8s cluster just run:

vagrant up
vagrant provision --provision-with k8s

You can now connect to the controller node and use kubectl using:

vagrant ssh controller

kubectl cluster-info

Documentation

Some notes

  • This uses the following Vagrant plugins (automatically installed):
    • vagrant-hostmanager
    • vagrant-env
  • You can change some variables for kubespray in the .env file (or using environment variables)

Environment variables

The following environment variables can be used to overwrite values from .env file:

  • KUBESPRAY_VER

pre-commit hooks

Read the pre-commit hooks document for more info.

git-chglog

Read the git-chglog document for more info.