Quick Start
Make sure the prerequisites are installed.
1. Build the host binary
The host binary runs the vbox, vault and user commands from your machine. vagrant up builds the Linux binary for the VMs by itself.
git clone https://github.com/gilmararaujo/k8s-provisioner.git
cd k8s-provisioner
make deps
make build-darwin-arm64 # or build-darwin-amd64, build-linux-amd64, build-linux-arm64, build-windows-amd64
Or download a pre-built binary.
2. Create the cluster
cd vagrant
vagrant up
This creates four VMs and installs everything:
| VM | IP | Role |
|---|---|---|
| storage | 192.168.56.20 | NFS server, HashiCorp Vault, lab DNS (CoreDNS + etcd) |
| controlplane | 192.168.56.10 | Kubernetes control plane |
| node01 | 192.168.56.11 | Worker |
| node02 | 192.168.56.12 | Worker |
When it finishes, vagrant up exports the lab CAs to vagrant/certs/ and prints the host setup commands for your OS, with the CA fingerprints.
3. Promiscuous mode (MetalLB)
The Vagrantfile enables promiscuous mode on every up, reload and resume. If LoadBalancer IPs (192.168.56.200-250) are not reachable from the host, enable it again:
../build/k8s-provisioner-darwin-arm64 vbox promisc # macOS Apple Silicon
../build/k8s-provisioner-linux-amd64 vbox promisc # Linux
..\build\k8s-provisioner-windows-amd64.exe vbox promisc # Windows
Why? MetalLB announces LoadBalancer IPs with ARP (Layer 2 mode). VirtualBox blocks that traffic between the VMs and the host unless promiscuous mode is on.
4. Access the cluster
# Copy the admin kubeconfig (it already points at https://192.168.56.10:6443)
vagrant ssh controlplane -c 'sudo cat /etc/kubernetes/admin.conf' > ~/.kube/config-lab
export KUBECONFIG=~/.kube/config-lab
kubectl get nodes
Expected output:
NAME STATUS ROLES AGE VERSION
controlplane Ready control-plane 12m v1.37.x
node01 Ready <none> 10m v1.37.x
node02 Ready <none> 10m v1.37.x
5. Host setup (DNS + trusted CAs)
Run the commands vagrant up printed, from the vagrant/ directory. They point lab.internal at the lab DNS and trust the lab and Vault CAs. See Host Setup for the commands per OS and why each one is needed.
6. Open the web UIs
Every UI is published by ExternalDNS and served over HTTPS by the Istio ingress gateway:
| URL | Service | Login |
|---|---|---|
https://grafana.lab.internal | Grafana (the k8s-lab dashboard is preinstalled) | “Sign in with Keycloak”, or admin + password from Vault |
https://prometheus.lab.internal | Prometheus | none |
https://alertmanager.lab.internal | Alertmanager | none |
https://kiali.lab.internal/kiali | Kiali (service mesh) | none (anonymous) |
https://keycloak.lab.internal | Keycloak admin console | admin + password from Vault |
https://vault.lab.internal:8200 | HashiCorp Vault UI | root token |
https://karpor.lab.internal | Karpor (only when enabled) | none |
Read a password from Vault with the CLI on the controlplane:
vagrant ssh controlplane -c \
'sudo k8s-provisioner vault get k8s-provisioner/grafana/admin password -c /etc/k8s-provisioner/config.yaml'
7. kubectl login via Keycloak (OIDC)
The API server trusts Keycloak as an OIDC provider: k8s-admins → cluster-admin, k8s-developers → view. A ready-made kubeconfig is stored in Vault.
# Fetch the OIDC kubeconfig (from the vagrant/ directory)
vagrant ssh controlplane -c \
'sudo k8s-provisioner vault get k8s-provisioner/kubeconfig-oidc config -c /etc/k8s-provisioner/config.yaml' \
> ~/.kube/config-oidc
# Password of the test user k8sadmin (group k8s-admins)
vagrant ssh controlplane -c \
'sudo k8s-provisioner vault get k8s-provisioner/keycloak/users/k8sadmin password -c /etc/k8s-provisioner/config.yaml'
# A browser opens for the Keycloak login
KUBECONFIG=~/.kube/config-oidc kubectl get nodes
Requires kubelogin and step 5. See Keycloak for adding users.
Pre-built Binaries
Download from GitHub Releases (each release has a checksums.txt):
| Platform | Binary |
|---|---|
| macOS Apple Silicon | k8s-provisioner-darwin-arm64 |
| macOS Intel | k8s-provisioner-darwin-amd64 |
| Linux x64 | k8s-provisioner-linux-amd64 |
| Linux ARM64 | k8s-provisioner-linux-arm64 |
| Windows x64 | k8s-provisioner-windows-amd64.exe |
Next Steps
- Host Setup: what the DNS and CA commands do, and what to redo after recreating the lab
- Configuration: customize versions, components and VMs
- Components: deep dive into each component