Command · pk-metal
pk-metal sim
changes no machineno cluster necessary
pk-metal sim serves simulated BMCs that speak Redfish. Use it for tests and for the virtual lab.
It does not talk to the cluster, and it touches no real machine.
Synopsis
Section titled “Synopsis”pk-metal sim serve [--fixture <name|path>] [--listen addr] [--tls] [--verbose]Subcommands
Section titled “Subcommands”| Subcommand | Effect |
|---|---|
serve |
Serves one simulated BMC from a fixture. No machine is behind it. |
fleet |
Serves many simulated BMCs from one file. Behind each BMC is nothing, a QEMU virtual machine or a Talos container. |
The two subcommands run until you stop them. When fleet stops, it turns its machines off.
pk-metal sim serve [--fixture <name|path>] [--listen addr] [--tls] [--verbose]
| Flag | Default | Description |
|---|---|---|
--fixture<string> | generic | Name of a built-in fixture (generic, huawei-2288h-v5, supermicro-x12) or the path of a fixture YAML file. |
--listen<string> | 127.0.0.1:8000 | Listen address. |
--tls | false | Serve HTTPS with a temporary self-signed certificate. |
--verbose | false | Log each request (default: only the requests that change state). |
A fixture describes one BMC: its vendor, its accounts, its virtual media slots and its behavior.
The program has three built-in fixtures: generic, huawei-2288h-v5 and supermicro-x12.
The operator accepts only HTTPS addresses for a BMC. Give --tls when you enroll the simulated BMC.
pk-metal sim fleet --config <file> [--verbose] [--state-listen addr]
| Flag | Default | Description |
|---|---|---|
--config<string>required | - | Fleet file (YAML): the machines, their BMC addresses, identities and backends. |
--state-listen<string> | 127.0.0.1:8440 | Address of the read-only state endpoint (plain HTTP); an empty value serves none. |
--hang-timeout<duration> | - | Power cycle a virtual machine one time when its console shows only firmware output for this long after a power-on (0: never). |
--verbose | false | Log each request (default: only the requests that change state). |
The fleet file gives each machine an HTTPS endpoint, a personality, an identity and a backend.
The fleet also serves the state of all machines as JSON on the state endpoint. pk-metal top reads it with --fleet.
The log
Section titled “The log”The simulator logs each request that changes state: power, media and boot override. It also logs the small JSON body.
With --verbose, it logs the read requests too. The log shows *** in place of each password. The start line of serve shows the account of the fixture, which is not a secret.
Examples
Section titled “Examples”pk-metal sim serve --fixture generic --listen 127.0.0.1:8000 --tls
sim: serving generic (Generic) on https://127.0.0.1:8000/redfish/v1 (account admin / admin-pass)
sim: POST /redfish/v1/SessionService/Sessions -> 201 {"UserName":"admin","Password":"***"}
sim: POST /redfish/v1/Systems/1/Actions/ComputerSystem.Reset -> 200 {"ResetType":"ForceRestart"}
Test the simulated BMC from a second terminal.
PK_METAL_BMC_PASSWORD=admin-pass pk-metal check --insecure https://127.0.0.1:8000Run a fleet. In the virtual lab, mise run lab:up does this for you.
pk-metal sim fleet --config .lab/generated/fleet.yaml
sim fleet: node-1: huawei-2288h-v5 BMC on https://10.77.0.1:8441/redfish/v1 (account admin), backend qemu
sim fleet: node-2: supermicro-x12 BMC on https://10.77.0.1:8442/redfish/v1 (account admin), backend qemu
sim fleet: state of every machine on http://127.0.0.1:8440/state (read-only; watch it with: pk-metal top --fleet http://127.0.0.1:8440/state)
Objects
Section titled “Objects”The command reads and writes no object in the cluster. The operator sees a simulated BMC as a normal ManagementEndpoint.
Exit status
Section titled “Exit status”fleet gives code 1 if one of its machines fails.
Related
Section titled “Related”- Simulated BMC describes the fixtures, the fleet file and the state endpoint.
- mise run lab:up starts the fleet, the virtual machines and the management cluster.
- pk-metal top shows the state of the fleet.
- Your first cluster in the lab