https://github.com/fcrespel/k8s-vagrant-node
Kubernetes Vagrant node (master/worker) for local testing with CRI-O, Calico, WireGuard, Ingress Nginx and OpenEBS
https://github.com/fcrespel/k8s-vagrant-node
calico cri-o ingress-nginx k8s kubernetes openebs vagrant wireguard
Last synced: 2 months ago
JSON representation
Kubernetes Vagrant node (master/worker) for local testing with CRI-O, Calico, WireGuard, Ingress Nginx and OpenEBS
- Host: GitHub
- URL: https://github.com/fcrespel/k8s-vagrant-node
- Owner: fcrespel
- License: mit
- Created: 2021-06-03T17:35:12.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-12-29T16:23:38.000Z (6 months ago)
- Last Synced: 2026-01-01T20:52:53.710Z (5 months ago)
- Topics: calico, cri-o, ingress-nginx, k8s, kubernetes, openebs, vagrant, wireguard
- Language: Shell
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kubernetes Vagrant node
This repository contains a [Vagrant](https://www.vagrantup.com) VM to run a Kubernetes node (master or worker) for local testing/debugging, using:
- [CRI-O](https://cri-o.io) as the container runtime
- [Calico](https://www.projectcalico.org) as the network plugin
- [WireGuard](https://www.wireguard.com) to encrypt communication between nodes
- [Ingress Nginx](https://kubernetes.github.io/ingress-nginx/) to expose ingress resources
- [OpenEBS](https://openebs.io) to support local persistent volumes
## Prerequisites
Make sure you have [VirtualBox](https://www.virtualbox.org) and [Vagrant](https://www.vagrantup.com) installed before starting.
You may clone this repository mutliple times in different folders to build a cluster with multiple VMs (e.g. 1 master and 2 workers).
## Configuration
First, configure the `Vagrantfile`:
- Update the `private_network` IP address (e.g. 192.168.56.101 for master, 192.168.56.102 for worker).
- Adjust `vb.memory` depending on your available RAM and node role (at least 2048 MB for a master, less for a worker).
Edit the `provision.conf.sh` file:
- Update `K8S_MASTER_IP` if you changed it in the master `Vagrantfile`
- Set `K8S_NODE_ROLE` to `master` or `worker`
- Set `K8S_NODE_NAME` to an arbitrary name (e.g. `node1`, `node2`, ...)
For a worker node, you will need to obtain a token and certificate hash from the master first. This information is displayed at the end of master creation, if necessary you can get it again with:
```
kubeadm token create
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
```
Then, update the worker `provision.conf.sh`:
- Set `K8S_TOKEN` to the join token
- Set `K8S_CERTHASH` to the certificate hash
## Running
Start the VM by running `vagrant up` in the repository directory. The provisioning script will take some time to install and configure the node.
When done or if an error occurs, you should restart the VM with `vagrant reload` to make sure the updated kernel and modules are properly loaded.
After that, you may get a shell in the VM with `vagrant ssh`, and run commands such as the following:
```
# Switch to root
sudo su -
# Check pod/deployment status
kubectl get all -A
# Check Calico node status
calicoctl node status
# Check WireGuard status
wg
# Check containers running locally
crictl ps
```
If everything is OK, you may deploy pods with `kubectl` or `helm`, or configure Calico resources with `calicoctl`. You may also use `k9s` to get an interactive text-based interface; `kubectx` and `kubens` utilities are also available.
Note that Ingress Nginx is preinstalled and exposed on node ports 30080 (HTTP) and 30443 (HTTPS).