The vpsm CLI

vpsm connects your computer to private databases and k3s clusters on your servers through an encrypted tunnel. No database or Kubernetes port is ever opened to the internet.

Install

Prebuilt downloads: [CLI DOWNLOAD LINK, not published yet]. Until then, build it from source with Go: run make cli in the agent/ folder of the source tree. The binary is written to agent/bin/vpsm.

Create an access token

The CLI signs in with a personal API token for one organization.

  1. In your workspace, open Settings → Security and find API tokens for <your org>.
  2. Enter a Token name (for example laptop) and pick when it Expires (default 90 days).
  3. Tick the permissions it needs. For the CLI: org:read, db:read and db:query for databases, and cluster:read for clusters. You can only grant permissions you have yourself.
  4. Click Create and confirm your password. Copy the token now: it starts with vpsm_pat_ and is shown only once.

A token can never do more than your role allows, even if your role changes later. Revoke it from the same page with Revoke.

Sign in

vpsm login --api https://<api host>

Paste the token when asked (or pass --token, though that leaves it in your shell history). The CLI checks the token and prints Logged in as <you> to <org>. The token is saved in your user config folder (vpsm/config.json, readable only by you). --api can also come from the VPSM_API environment variable.

vpsm whoami    # who and which organization you are signed in as
vpsm version

vpsm db connect

vpsm db connect <name or id> [--port 15432]

Opens a local port on 127.0.0.1 that forwards to the database on its server. Default ports: PostgreSQL 15432, MySQL 13306, Redis 16379. The CLI prints a ready-made connection command, for example:

psql 'postgres://app:<password>@127.0.0.1:15432/app'

Fill in the password from the database page (Connect → Show connection URL). Press Ctrl-C to stop.

Each connection you open gets its own short-lived, single-use ticket tied to you, the database and your IP address. Traffic goes through our API and the server's agent; nothing listens on the server.

vpsm kube connect

vpsm kube connect <name or id> [--port 16443] [--kubeconfig <path>]

This does two things:

  1. Writes a kubeconfig, by default ~/.kube/vpsm-<cluster id>.json (readable only by you), pointing at https://127.0.0.1:16443 with the cluster's CA.
  2. Opens the tunnel to the cluster's API server. TLS runs end to end from kubectl to the cluster.

Then, in another terminal:

export KUBECONFIG=~/.kube/vpsm-<cluster id>.json
kubectl get pods -A

kubectl gets its credentials from vpsm itself: a Kubernetes token valid for one hour, cached until shortly before it expires. If your token has cluster:manage and you hold that permission, you get admin access in the cluster; otherwise read-only access. When you lose access in VPS Manager, your cluster tokens are removed too.