CLI Reference

Complete command-line reference for k8s-provisioner

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

CommandRuns on
provision …Inside the VMs (Vagrant runs it for you)
statusInside 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)
versionAnywhere

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-commandWhat it does
provision commonSwap off, kernel modules, sysctl, DNS, timezone, CRI-O, kubeadm/kubelet/kubectl
provision initcommon + bootstrap the control plane (kubeadm init, Calico) and write the worker join command
provision controlplaneBootstrap the control plane only
provision workerJoin this node as a worker
provision workloadsInstall every cluster add-on in dependency order (MetalLB, Istio, cert-manager, Vault, Keycloak, monitoring, …)
provision allcommon + 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:

PathKeys
k8s-provisioner/grafana/adminusername, password
k8s-provisioner/keycloak/adminusername, password
k8s-provisioner/keycloak/postgresusername, password
k8s-provisioner/keycloak/users/k8sadminusername, password
k8s-provisioner/keycloak/users/developerusername, password
k8s-provisioner/keycloak/clients/grafanaclient_id, client_secret
k8s-provisioner/api-keysollama_api_key, karpor_auth_token, alertmanager_config
k8s-provisioner/kubeconfig-oidcconfig

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
FlagCommandDescription
--kubeconfigall user commandsAdmin kubeconfig used to create the user (default ~/.kube/config)
--output-dirall user commandsWhere certificates are stored (default ~/.k8s-users)
-g, --groupcreateGroup(s) for the user; repeatable
-n, --namespacecreate, create-roleNamespace for the RoleBinding / Role
--cluster-rolecreateClusterRole to bind (view, edit, admin, cluster-admin)
--rolecreateRole to bind (requires --namespace)
--expirationcreateCertificate lifetime in days (default 365)

What Gets Created

FileDescription
~/.k8s-users/<username>/<username>.keyRSA private key
~/.k8s-users/<username>/<username>.crtX.509 certificate signed by the cluster CA
~/.k8s-users/<username>/<username>.kubeconfigKubeconfig 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

ClusterRolePermissions
viewRead-only access to most resources
editRead/write access (no RBAC)
adminFull access within a namespace
cluster-adminFull cluster access