Documentation

esc
    Move to Pantech / The Migrate agent

    The Pantech Migrate agent

    The program you run in your own network so Pantech can read a cloud, copy a server, import a database or move a cluster without ever holding their credentials. Install it, enroll it on any connection with a one-time code, configure its database sources and cluster, check it, and revoke it.

    The Pantech Migrate agent is a small program you run in your own environment. It holds the credentials for your sources (a read-only cloud token, database connection strings, a kubeconfig), uses them there, and sends Pantech only what it found or copied. Those credentials never leave your machine, and nothing on Pantech can ask for them.

    Any connection can have an agent, whatever the cloud. What it does depends on the connection and on what you give it:

    ConnectionWhat the agent runs
    DigitalOcean, Hetzner Cloud, Linode, Vultr, Contabo, OpenStackScans, with a read-only token in its environment, and the copy steps below
    AWS, Google Cloud, Azure, Huawei CloudOnly the copy steps below. Pantech scans these clouds itself, so the agent needs no cloud token there

    The copy steps that read from inside your network all go through the agent: copying a server from the server itself, importing a database, and moving a Kubernetes cluster.

    What it is, and what it is not

    • It only connects out, over HTTPS, straight to the Pantech API. It listens on no port, so nothing can connect to it. It refuses an API address that is not https, and it follows no redirect: give it https://api.pantechdynamics.com itself, not an address that forwards there.
    • It has one connection's credential. After it enrolls, it holds a credential (pma_…) bound to one connection in your organization. With it the agent can rotate the credential, ask for that connection's work, send what that work produced, and report a failure. Nothing else: no API key or console session works on the agent's routes, and the agent's credential works nowhere else.
    • It keeps your credentials to itself. Your cloud token is read from the agent's environment and sent only to your cloud's own API. Database connection strings and kubeconfigs are read on the agent's machine and used there. None of them is ever sent to Pantech, and the agent's logs drop anything that looks like a credential.
    • It does only what you set it up for. A server copy reads only the disks of the server it runs on. Kubernetes copy pods run only Pantech's copier image. A database import reads only a source you named in its configuration.
    • What it sends is checked as data. Pantech checks every field before storing anything, and refuses the whole upload if one field is wrong.

    Agreement

    You download and run the agent under the Pantech Migrate Agent Agreement. It gives you a licence to use the agent only to move your own workloads to Pantech, and you may run it only on systems, accounts, databases and clusters you own or are authorised to use. Your cloud tokens, database credentials and kubeconfigs stay yours and stay on your machine. The agent connects only outward, to the Pantech API over HTTPS, and sends only what the jobs you start produce. You can revoke it at any time.

    Install it

    The connection's setup.agent gives the container image (image) and the commands to run (enroll_command, run_command, container_command). Use what it returns.

    The image is ghcr.io/pantech-dynamics/pantech-migrate-agent, a minimal, non-root container whose state lives in /state. Keep that in a volume, so the credential survives restarts:

    Terminal
    $ docker run --rm -v pantech-migrate:/state <agent-image> \    enroll --api https://api.pantechdynamics.com --code pme_…$ docker run --rm -v pantech-migrate:/state -e HCLOUD_TOKEN <agent-image> run

    -e HCLOUD_TOKEN passes the variable from your own shell into the container without writing it on the command line. setup.agent.container_command is the same pair of commands with your cloud's variables filled in.

    The container runs scans and Kubernetes moves. It has no database dump tools and cannot read a host's disks, so database imports and server copies need the program itself.

    Run it as a service (systemd, a container restart policy, a scheduled task) so it is there when work arrives.

    Enroll it

    1. Issue a code for the connection: POST /cloud-connections/{connection_id}/agent-enrollments, pantech migrate agent enroll <connection id>, or ask your AI app. The response holds code (pme_…), expires_at and enroll_command.
    2. Enroll on the machine where the agent runs: pantech-migrate-agent enroll --api https://api.pantechdynamics.com --code pme_…. To keep the code out of your shell history, pass --code - and paste it on standard input.
    3. The agent saves its credential and prints the connection it enrolled for. On a DigitalOcean, Hetzner Cloud, Linode, Vultr, Contabo or OpenStack connection, the connection is now connected. On AWS, Google Cloud, Azure and Huawei Cloud, the connection's status stays what its own setup made it.

    The code is shown only once, works once, and expires after an hour. Issuing another code replaces one that was not used. Only Owners and Admins can issue a code.

    One agent per connection

    A connection has one agent at a time. Enrolling again, on this machine or another, replaces the connection's earlier agent, whose credential stops working.

    That matters when you copy a server: the agent that copies a server runs on that server, so enrolling it there replaces the agent you run elsewhere for scans, imports and moves. Copy one server at a time, then enroll your long-running agent again with a new code.

    Configure it

    A token in the environment is enough for scans. Database imports and Kubernetes moves read what they need from the agent's configuration file, config.json, next to its state file (or --config <file>). The file holds names and paths, never a password:

    config.json
    {
      "database_sources": {
        "orders": {"engine": "postgres", "dsn_env": "ORDERS_DSN"},
        "shop":   {"engine": "mysql", "dsn_file": "/etc/pantech-migrate/shop.dsn"}
      },
      "kubernetes": {"kubeconfig": "/etc/pantech-migrate/reader.kubeconfig"},
      "max_jobs": 4
    }
    KeyWhat it is
    database_sourcesEach database the agent may import from, under the name you give the import as its source_ref (1 to 64 letters, digits, ., _ and -). engine is postgres, mysql or mariadb. The connection string is read, when an import runs, from exactly one of dsn_env (an environment variable) or dsn_file (a file only the agent's user can read). See importing databases
    kubernetes.kubeconfigThe read-only kubeconfig for the source cluster. See moving Kubernetes
    kubernetes.copier_imageOptional: the only image volume copy pods may run. See the copier image
    max_jobsHow many jobs the agent runs at once, 1 to 8. 4 when left out. run --max-jobs overrides it

    The agent refuses a configuration file other users can change (chmod go-w config.json), and a dsn_file other users can read (chmod 600). In the container, keep config.json in the state volume (/state/config.json) and mount the files it names.

    Check it

    Terminal
    $ ORDERS_DSN=… pantech-migrate-agent checkdatabase source orders: ok (postgres)database source shop: ok (mysql)kubernetes: kubeconfig read

    check reads the configuration, connects to each database source once and reads the kubeconfig, then prints only names and outcomes, never a connection string. It sends nothing to Pantech, and it exits non-zero if anything failed.

    Run it

    Terminal
    $ HCLOUD_TOKEN=… pantech-migrate-agent run

    run asks Pantech for the connection's work, carries it out, and asks again. It runs several jobs at once (max_jobs, 4 by default), so a long database import does not hold up a scan or a Kubernetes export. run --once stops as soon as nothing is waiting and nothing is running, which suits a scheduled job.

    The agent asks only for the work it is set up for: scans when it has a cloud token (on the clouds it scans), database imports when its configuration names a source, Kubernetes moves when it has a kubeconfig, and a server copy only when it was started with --server-copy for that copy. Each cloud's token variables are on its section; setup.agent.token_variables lists them too. An agent with nothing to run says so and stops.

    A scan waits for the agent. If no agent picks it up within an hour, it fails with agent_offline. The connection's agent shows online (it asked for work in the last two minutes), last_seen_at, agent_version and platform.

    See what it would upload

    Terminal
    $ HCLOUD_TOKEN=… pantech-migrate-agent scan --provider hetzner

    scan reads your cloud with the token and prints, as JSON, exactly the inventory a scan would upload, and uploads nothing. It also runs Pantech's checks on it, and says so if Pantech would refuse it. Without --provider it uses the enrolled connection's cloud. Use it to check a token before you enroll, or to see what leaves your machine.

    Where it keeps its state

    The agent's state file holds its credential, never your cloud's token or a database password. It is written atomically and readable only by its owner (mode 0600), and the agent refuses to use a state file anyone else can read.

    Path
    Defaultpantech-migrate-agent/agent.json in your user configuration directory
    Set it--state <file>, or PANTECH_MIGRATE_AGENT_STATE
    Container/state/agent.json

    Credential rotation

    The agent's credential lasts six hours, and Pantech asks the agent to rotate it every hour. The agent saves the new credential before it uses it; the old one keeps working until the new one is first used, so a rotation whose answer is lost costs nothing. A copied credential therefore stops working at the next rotation, and within six hours at most.

    An agent that was stopped for longer than six hours must be enrolled again with a new code.

    Revoke the agent

    Terminal
    $ curl -X DELETE https://api.pantechdynamics.com/public/v1/cloud-connections/ccn_06gk3x9tq7m2v8r4y1c5d0zp8w/agent \    -H "Authorization: Bearer $PANTECH_API_KEY" \    -H "Idempotency-Key: $(uuidgen)"

    The agent's credential stops working on its very next request, and the connection waits for a new agent. A server copy the agent was sending stops receiving its disks at once; the copy itself waits, and carries on when you enroll the agent on that server again. The agent stops, saying Pantech no longer accepts it. Revoking again changes nothing. Disconnecting the connection revokes its agent too.

    Then delete the agent's state file, and the token in your cloud if you no longer need it.

    Limits

    • 600 requests a minute per agent.
    • 20 enrollment attempts, or failed sign-ins, a minute from one address.
    • One upload of at most 9 MiB per scan, of at most 2,000 items of each kind.
    • 8 jobs at once.

    Every refusal looks the same

    When Pantech will not accept a code or a credential (unknown, expired, used or revoked), the answer is always 401 AGENT_UNAUTHENTICATED, without saying which. Issue a new code and enroll again. An agent too old for Pantech is told to upgrade (AGENT_PROTOCOL_UNSUPPORTED): install the latest version.

    Was this page helpful?

    Updated