An open API service indexing awesome lists of open source software.

https://github.com/giwiro/k8s-vagrant

A streamlined Vagrant/Ubuntu setup for local Kubernetes clusters. Utilizes kubeadm for cluster management and setup, Flannel as CNI, and CRI-O as CRI. Ideal for local K8s development and testing environments.
https://github.com/giwiro/k8s-vagrant

crio devops flannel kubeadm kubernetes kubernetes-cluster ubuntu vagrant virtualbox

Last synced: about 2 months ago
JSON representation

A streamlined Vagrant/Ubuntu setup for local Kubernetes clusters. Utilizes kubeadm for cluster management and setup, Flannel as CNI, and CRI-O as CRI. Ideal for local K8s development and testing environments.

Awesome Lists containing this project

README

          


logo

k8s-vagrant


Your Local Kubernetes Playground β˜ΈοΈπŸ›. Get a fully-functional local Kubernetes cluster in minutes!







## Description

Tired of cloud bills?
This project provides a simple yet robust solution for quickly provisioning a local Kubernetes
cluster using Vagrant & Ubuntu, Kubeadm, Flannel, and CRI-O. Designed with developers in mind, it offers an efficient
and cost-effective way to learn Kubernetes, test applications, and prototype deployments without incurring expensive
cloud infrastructure fees.

## System Prerequisites

- Software Requirements:
- **[Git](https://git-scm.com/)**: For cloning the repository.
- **[Vagrant](https://developer.hashicorp.com/vagrant)**: Core tool for managing virtual machines.
- **[VirtualBox](https://www.virtualbox.org/)**: For virtualization purposes.

## Installation

1. Clone this repository

```bash
git clone https://github.com/giwiro/k8s-vagrant.git
```

2. Change directory to the cloned repository

```bash
cd k8s-vagrant
```

3. Run the Vagrantfile

```bash
vagrant up
```

4. Verify installation

```bash
vagrant ssh master -c 'kubectl get nodes -o wide'
```

And you should see something like this:

```
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master Ready control-plane 9m36s v1.33.5 192.168.1.2 Ubuntu 22.04.5 LTS 5.15.0-151-generic cri-o://1.33.4
worker1 Ready 6m10s v1.33.5 192.168.2.2 Ubuntu 22.04.5 LTS 5.15.0-151-generic cri-o://1.33.4
worker2 Ready 3m21s v1.33.5 192.168.2.3 Ubuntu 22.04.5 LTS 5.15.0-151-generic cri-o://1.33.4
```

## Configuration

In the `Vagrantfile` you can change the default configuration.

```ruby
# _____ __ _
# / ____| / _(_)
# | | ___ _ __ | |_ _ __ _
# | | / _ \| '_ \| _| |/ _` |
# | |___| (_) | | | | | | | (_| |
# \_____\___/|_| |_|_| |_|\__, |
# Custom configuration __/ |
# |___/

VMProvider = "virtualbox"
Image = "bento/ubuntu-22.04"
MasterPrivateIp = "192.168.1.2"
NumberNodes = 2
NodesPrivateIpPrefix = "192.168.2."
PodNetworkCIDR = "10.1.0.0/16"
KubernetesVersion = "v1.33"
CrioVersion = "v1.33"
TLSCheckDisable = "true"
```

- `VMProvider`: By default is `virtualbox`, but you can change it to whatever you want, make sure the box you provide
supports it.
- `Image`: By default is `bento/ubuntu-22.04`, this [box](https://portal.cloud.hashicorp.com/vagrant/discover/bento/ubuntu-22.04)
includes multiple architectures (arm64, amd64) for different providers (parallels, utm, virtualbox, vmware_desktop).
So if you have Apple Silicon Mac, you can/should use `bento/ubuntu-22.04`, otherwise you can use `ubuntu/jammy64`.
- `NumberNodes`: By default is `2`, but you can change it to whatever you want.
- `NodesPrivateIpPrefix`: It defined the first three octets of the worker nodes. By default is `192.168.2.`, and the
first ip will start from `2`. So for the first two nodes
their ips would be `192.168.2.2` and `192.168.2.3`.
- `TLSCheckDisable`: This option is by default set to `true`, which disables all TLS checks, in case you are behind a
firewall. What it does is:
- Adds the `-k` option to `curl`.
- Adds `Acquire::https::Verify-Peer "false";` configuration to `apt`.
- Adds `insecure-registry` config to `crio`.
- Adds `--no-check-certificate` option to `wget`.

## Resources configuration

The resource configuration is done in the `Vagrantfile` too, feel free to change it.

By default, the master node has 4GB of RAM and 2 CPUs.
```ruby
master.vm.provider VMProvider do |vb|
vb.memory = "4096"
vb.cpus = "2"
end
```

By default, the worker nodes have 4GB of RAM and 2 CPUs.
```ruby
worker.vm.provider VMProvider do |v|
v.memory = "4096"
v.cpus = "2"
end
```

## License

[MIT](LICENSE)

[kubernetes-badge]: https://img.shields.io/github/v/release/kubernetes/kubernetes?filter=v1.33.4&label=kubernetes
[kubernetes-url]: https://github.com/kubernetes/kubernetes

[flannel-badge]: https://img.shields.io/github/v/release/flannel-io/flannel?label=flannel
[flannel-url]: https://github.com/flannel-io/flannel

[crio-badge]: https://img.shields.io/github/v/release/cri-o/cri-o?filter=v1.33.4&label=cri-o
[crio-url]: https://github.com/cri-o/cri-o

[license-badge]: https://img.shields.io/github/license/giwiro/k8s-vagrant
[license-url]: https://github.com/giwiro/k8s-vagrant/blob/main/LICENSE