Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/stackzoo/k8s-local-cluster

Deploy a local multinode k8s cluster with vagrant and ansible πŸ”§ ☸️
https://github.com/stackzoo/k8s-local-cluster

ansible development kubernetes vagrant

Last synced: 26 days ago
JSON representation

Deploy a local multinode k8s cluster with vagrant and ansible πŸ”§ ☸️

Awesome Lists containing this project

README

        

# k8s-local-cluster
[![ansible-lint](https://github.com/stackzoo/k8s-local-cluster/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/stackzoo/k8s-local-cluster/actions/workflows/ansible-lint.yml)

Deploy a local multinode k8s cluster with vagrant and ansible πŸ”§ ☸️

## Abstract
This repo allows you to create a local development cluster using `vagrant` and `ansible`.


Solutions like `KinD` and `Minikube` are excellent but often limited.


With a cluster made up of several VMs it is possible to test a scenario that is closer to a production context.

## Prerequisites
- `ansible`
- `vagrant`

## Instructions

### Define amount of nodes
Modify the following variable in Vagrantfile:
```
N =
```

### Spin up cluster
```
$ vagrant up
```

### Verify on master
```
$ vagrant ssh k8s-master
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready control-plane,master 5m6s v1.26.0
k8s-worker-1 Ready 2m59s v1.26.0
k8s-worker-2 Ready 68s v1.26.0
```

## Useful Commands

*vagrant status* β€” Get the current status of your VM

*vangrant destroy* β€” Remove all traces of the virtual machine from your system

*vagrant suspend* β€” Stop the machine and save its current state.

*vagrant provision {vm-name}* β€” Manually execute ansible playbook against a VM.

*vagrant halt* β€” Shut down the virtual machine.

*vagrant box list* - List local vagrant box images

*vagrant box remove {vagrant-box-image-name}* - Remove local vagrant box images

*vagrant plugin list* - List local vagrant plugins