CLI Reference
Global Flags
k8s-provisioner [command] [flags]
Flags:
-c, --config string config file path (default "/etc/k8s-provisioner/config.yaml")
--dry-run preview commands without mutating the host
-h, --help help for k8s-provisioner
-v, --verbose verbose output
Inside the VMs the default path is where Vagrant puts config.yaml. Every command except version, status, vbox and help loads the config, so on the host run them from the repository root with -c config.yaml (for example vault and user create).
Where Each Command Runs
| Command | Runs on |
|---|---|
provision … | Inside the VMs (Vagrant runs it for you) |
status | Inside the controlplane VM |
vault … | Controlplane VM (reads vault-init.json), or the host with VAULT_TOKEN and the Vault CA trusted |
vbox … | Host |
user … | Host (needs a kubeconfig with cluster-admin) |
version | Anywhere |
version
k8s-provisioner version
k8s-provisioner v2.4.0
Git Commit: 8894bff
Build Date: 2026-10-31T12:00:00Z
Go Version: go1.27.3
Platform: darwin/arm64
Configured component versions:
...
status
Show cluster and node status.
k8s-provisioner status
provision
Provision the current node based on its role. vagrant up runs these for you.
| Sub-command | What it does |
|---|---|
provision common | Swap off, kernel modules, sysctl, DNS, timezone, CRI-O, kubeadm/kubelet/kubectl |
provision init | common + bootstrap the control plane (kubeadm init, Calico) and write the worker join command |
provision controlplane | Bootstrap the control plane only |
provision worker | Join this node as a worker |
provision workloads | Install every cluster add-on in dependency order (MetalLB, Istio, cert-manager, Vault, Keycloak, monitoring, …) |
provision all | common + init or worker, by looking up the hostname in config.yaml nodes:. Does not install workloads |
sudo k8s-provisioner provision workloads --dry-run # print what would run
vault
Read and write secrets in HashiCorp Vault on the storage node.
k8s-provisioner vault status # connectivity and seal status
k8s-provisioner vault token # print the root token (controlplane)
k8s-provisioner vault get <path> [key] # read a secret (all keys, or one key)
k8s-provisioner vault set <path> <key> <value> # write a key (other keys are preserved)
k8s-provisioner vault unseal # unseal after a storage node reboot
Each lab login has its own path, with plain keys:
| Path | Keys |
|---|---|
k8s-provisioner/grafana/admin | username, password |
k8s-provisioner/keycloak/admin | username, password |
k8s-provisioner/keycloak/postgres | username, password |
k8s-provisioner/keycloak/users/k8sadmin | username, password |
k8s-provisioner/keycloak/users/developer | username, password |
k8s-provisioner/keycloak/clients/grafana | client_id, client_secret |
k8s-provisioner/api-keys | ollama_api_key, karpor_auth_token, alertmanager_config |
k8s-provisioner/kubeconfig-oidc | config |
Examples:
# From the host, through the controlplane (no token handling)
vagrant ssh controlplane -c \
'sudo k8s-provisioner vault get k8s-provisioner/grafana/admin password -c /etc/k8s-provisioner/config.yaml'
# From the host directly
export VAULT_TOKEN=hvs.xxxx
export VAULT_CACERT=$PWD/vagrant/certs/k8s-lab-vault-ca.crt # if the Vault CA is not trusted system-wide
./build/k8s-provisioner-darwin-arm64 vault get k8s-provisioner/keycloak/users/k8sadmin -c config.yaml
vbox
VirtualBox management (run on the host).
k8s-provisioner vbox promisc # enable promiscuous mode on all lab VMs
k8s-provisioner vbox status # show promiscuous mode status
k8s-provisioner vbox list # list all VirtualBox VMs
MetalLB announces LoadBalancer IPs with ARP; VirtualBox blocks that traffic to the host unless promiscuous mode is on. The Vagrantfile already enables it on every up, reload and resume.
user
Create and manage Kubernetes users with X.509 certificate authentication. For browser-based logins through Keycloak, see OIDC.
# Cluster-wide view access
k8s-provisioner user create joao --cluster-role view -c config.yaml --kubeconfig ~/.kube/config-lab
# Edit access to one namespace
k8s-provisioner user create maria --namespace dev --cluster-role edit
# In a group, with admin access
k8s-provisioner user create pedro --group developers --cluster-role admin
# Custom certificate lifetime (default: 365 days)
k8s-provisioner user create ana --cluster-role view --expiration 30
# Create a developer Role in a namespace and bind a user to it
k8s-provisioner user create-role developer --namespace dev
k8s-provisioner user create carlos --namespace dev --role developer
k8s-provisioner user list
k8s-provisioner user delete joao
| Flag | Command | Description |
|---|---|---|
--kubeconfig | all user commands | Admin kubeconfig used to create the user (default ~/.kube/config) |
--output-dir | all user commands | Where certificates are stored (default ~/.k8s-users) |
-g, --group | create | Group(s) for the user; repeatable |
-n, --namespace | create, create-role | Namespace for the RoleBinding / Role |
--cluster-role | create | ClusterRole to bind (view, edit, admin, cluster-admin) |
--role | create | Role to bind (requires --namespace) |
--expiration | create | Certificate lifetime in days (default 365) |
What Gets Created
| File | Description |
|---|---|
~/.k8s-users/<username>/<username>.key | RSA private key |
~/.k8s-users/<username>/<username>.crt | X.509 certificate signed by the cluster CA |
~/.k8s-users/<username>/<username>.kubeconfig | Kubeconfig file |
Plus the RBAC binding (ClusterRoleBinding or RoleBinding).
Using the Generated Kubeconfig
# Direct use
kubectl --kubeconfig=~/.k8s-users/joao/joao.kubeconfig get pods
# Or merge with your config
KUBECONFIG=~/.kube/config:~/.k8s-users/joao/joao.kubeconfig kubectl config view --flatten > ~/.kube/config-merged
mv ~/.kube/config-merged ~/.kube/config
kubectl config use-context joao@k8s-lab
Built-in ClusterRoles
| ClusterRole | Permissions |
|---|---|
view | Read-only access to most resources |
edit | Read/write access (no RBAC) |
admin | Full access within a namespace |
cluster-admin | Full cluster access |