UCloud logo UCloud logo UCloud
v2026.7.0-k8s.18
  1. UCloud/Core
  2. 1. Introduction
  3. 2. Projects
  4. 3. API Tokens
    1. 3.1. Platform API Tokens
    2. 3.2. Provider API Tokens
  5. 4. Accounting
  6. 5. Orchestration
  7. 6. Frontend
  8. UCloud/IM for Slurm-based HPC
  9. 7. Installation
  10. 8. Architecture and Networking
  11. 9. User and Project Management
  12. 10. Filesystem Integration
    1. 10.1. Inter-provider file transfers
  13. 11. Slurm Integration
    1. 11.1. Application Management
    2. 11.2. Built-in Applications
  14. 12. Reference
    1. 12.1. Configuration
    2. 12.2. CLI
  15. 13. Appendix
    1. 13.1. Built-in Application Index
  16. UCloud/IM for Kubernetes
  17. 14. Installation
  18. 15. Architecture and Networking
  19. 16. Filesystem Integration
  20. 17. Compute Jobs
    1. 17.1. Networks
    2. 17.2. Public Links
    3. 17.3. Public IPs
    4. 17.4. License Servers
    5. 17.5. SSH Servers
    6. 17.6. Job Audit Log
    7. 17.7. Virtual machines
  21. 18. AI Inference
    1. 18.1. Architecture
    2. 18.2. Chat Middleware
    3. 18.3. Chat Playground
    4. 18.4. Model Discovery and Catalog
    5. 18.5. Dynamo Deployments
    6. 18.6. Usage and Accounting
    7. 18.7. Audit
    8. 18.8. Metrics
    9. 18.9. Security
  22. 19. Integrated applications
    1. 19.1. Syncthing
    2. 19.2. Integrated terminal
    3. 19.3. Kubernetes clusters
      1. 19.3.1. Architecture
      2. 19.3.2. Stacks
      3. 19.3.3. Creating a cluster
      4. 19.3.4. Cluster dashboard
      5. 19.3.5. Networking and storage
      6. 19.3.6. Maintenance and upgrades
      7. 19.3.7. Backup and recovery
      8. 19.3.8. Reference
  23. 20. UCX applications
    1. 20.1. Hello world
    2. 20.2. Data binding
    3. 20.3. UI events
    4. 20.4. Component reference
    5. 20.5. API reference
  24. 21. Reference
    1. 21.1. Configuration
    2. 21.2. CLI
  25. Style guidelines
  26. 22. Branding and identity for UCloud
  27. 23. Documentation
  28. H: Procedures
  29. 24. H: Procedures
  30. 25. H: Introduction
  31. 26. H: Auditing
  32. 27. H: Auditing scenario
  33. 28. H: GitHub actions
  34. 29. H: Deployment
  35. 30. H: 3rd party dependencies (risk assesment)
  36. Glossary
  37. 31. Glossary
  1. Links
  2. Source Code
  3. Releases

Stacks

The Kubernetes cluster application is a pre-release. It is not ready for production use, and the behavior and the interfaces can change.

A stack groups the resources of one application and keeps their state together. The Kubernetes cluster application is the only consumer of stacks today. This page describes the stack, its APIs, the stack KV-state and the way the cluster application uses them.

The stack

A stack groups the resources of one application: the machines, the network, the storage and the links. UCloud/Core records the stack and its access control list. The application creates and confirms the stack through the platform, and UCloud/IM provides the resources of the stack on the systems of the provider.

flowchart TB
    core["UCloud/Core<br/>Stack and access control list"]:::diagram-external-ucloud

    subgraph im["UCloud/IM"]
        resources["Resources<br/>Machines, network, storage and links"]:::diagram-provider-cube
        records["Database<br/>stack_state_records"]:::diagram-provider-circle-stack
    end

    class im diagram-provider-ucloud

    app["Application<br/>Processes of the stack"]:::diagram-provider-puzzle-piece

    app -->|"creates and confirms the stack"| core
    app -->|"requests the resources"| core
    core -->|"forwards the requests"| resources
    app -->|"reads and writes the records"| records

The stack of one application and the systems around it. It does not show the parts inside UCloud/Core and UCloud/IM.

Every resource of the stack carries the label ucloud.dk/stack-instance, which names the stack. See the Reference.

The creation of a stack is guarded by a lease. The application confirms the stack when the creation is complete. An application that stops before the confirmation leaves the stack to the platform, which removes the stack and its resources. A deletion removes the resources of the stack and its records.

The stack KV-state

The processes of one stack share the stack KV-state: a small record per purpose. UCloud/IM keeps the records in the stack_state_records table of its database. The table holds the records of every stack of the provider. Each stack has its own records, and the keys have the same names in every stack.

RuleMeaning
RecordA key, a value in JSON and a revision.
WriteThe write names the revision that the writer read. A write that meets a newer revision fails, and the writer retries from the new value.
DeadlineA write can name a deadline. The store rejects the write after the deadline.

The processes reach the records through the two APIs of a stack. UCloud/IM deletes the records and the credentials of a stack when the platform deletes the stack.

The records are not files on the state drive. The drive holds the files of the stack, for example the node inputs, the script bundle and the backups.

The APIs of a stack

A process of a stack reads and changes the stack through one of two APIs.

The session of the application

The application calls the platform over its session. The calls cover:

  • the resources of the stack: jobs, private networks and their addresses, services, public links, public IPs, drives and licenses;
  • the files of the stack on the state drive, for example the node inputs and the script bundle;
  • the records of the stack KV-state;
  • the user interface of the application: messages, navigation and file downloads;
  • the lifecycle of the stack: the creation, the confirmation and the heartbeat that guards the creation;
  • the control credential of a control plane node, for the stack-control API.

The creator, the dashboard and the recovery job of a Kubernetes cluster work this way. The API reference of the UCX applications lists the calls and the helpers of the session.

The stack-control API of UCloud/IM

A process that runs on the machines of the stack calls UCloud/IM directly. The calls cover:

  • the resources of the stack: jobs, services, public links, public IPs, private networks and their addresses;
  • the control of the resources: create, browse and retrieve them; terminate, suspend, unsuspend, extend and rename a job; change the labels; add or remove the members of a service; set the target of a public link and the firewall of a public IP;
  • the product lists of the resource types;
  • the records of the stack KV-state.

The caller presents the controller registration token of a control plane node. The token belongs to the job of the node, and it stops working when the job ends. The application asks UCloud/IM for the token over its session and writes it into the input files of the node. See Credentials.

The controller and the maintenance coordinator of a Kubernetes cluster work this way. They use the API directly, so they do not depend on a session that a user opened.

Both APIs admit only the processes of the stack: the session names the stack, and the token belongs to a job of the stack.

The application in a virtual machine

A stack can run its application inside one of its virtual machines. The application then serves its interface from the machines that it manages, and the platform delivers the executable of the application into the machine. The image of the machine stays generic.

The application follows these steps over its session:

  1. It writes two scripts into the files of the stack: a runner that starts the delivered executable with the UCX port and restarts it when a new executable arrives, and an init script that installs the service in the machine.
  2. It creates a virtual-machine job of the stack. The job carries the mounts of the stack files, the label of the init script (ucloud.dk/init-script) and the UCX labels: the port (ucloud.dk/ucxport) and the name and the version of the application. The platform creates the machine, mounts the delivered executable of the application into it, and opens the UCX port in the firewall.
  3. On the first boot, the agent of the machine runs the init script once. The service starts the runner; the runner runs the delivered executable and sets the UCX port; the application serves the port.
  4. The platform opens sessions to the application on the port of the machine. The browser reaches the interface of the application, and the application acts in the stack through its session.
flowchart TB
    write["Step 1<br/>Write the runner and the init script"]:::diagram-provider-code-bracket
    machine["Step 2<br/>Create the machine"]:::diagram-provider-server
    boot["Step 3<br/>First boot and the service"]:::diagram-provider-cog-6-tooth
    connect["Step 4<br/>Open the session"]:::diagram-provider-window

    write --> machine
    machine --> boot
    boot --> connect

The steps that put an application into a virtual machine of the stack. It does not show the delivery of the executable or the mounts of the machine.

For a Kubernetes cluster, the cluster dashboard runs this way as the custom UI service on every control plane node, on port 43102. The platform routes the browser to a control plane node that runs the service, and it selects another control plane node when the node does not answer, for example while its machine restarts during maintenance.

The update of the application

The provider can publish a new executable of the application at any time. The platform updates the application without a new machine image. The procedure:

  1. The provider builds, signs and publishes the executable (Deployment).
  2. UCloud/IM fetches the manifest of the application and its signature about once per second. It verifies the signature with the public key of the application.
  3. It fetches the executable and verifies its SHA-256 against the manifest. When the executable differs from the delivered file, UCloud/IM replaces the delivered file atomically, so a machine never reads a partial executable.
  4. The machines mount the directory that holds the delivered executable, so the new executable is present in every machine. The machines do not restart.
  5. The runner of the machine watches the size and the modification time of the delivered executable. When they change, it restarts the application with the new executable.

The platform keeps the executable of every version of the application in its own directory. A machine mounts the directory of the version that created it, so an update of one version reaches every machine of that version.

The stack of a Kubernetes cluster

The cluster application creates one stack per cluster. The stack holds the state drive, the private network, the service, the public links and the node jobs. Architecture lists every resource of the stack.

The cluster keeps the records that Architecture lists. The processes use them as follows:

ProcessUse of the records
CreatorWrites the cluster record during the creation.
DashboardReads the cluster record for the home page and the provisioning view.
Maintenance coordinatorWrites the operation records. Reads the rolling upgrade, the automatic maintenance and the backup records.
ControllerReads the traffic record.
Recovery jobReads the cluster record, and writes the recovery record.

Every process reads the cluster record before it changes the cluster. The Reference lists the key of every record.

The lifecycle of the cluster follows the lifecycle of the stack. The creator confirms the stack when the creation of the cluster is complete. A creation that stops leaves the cleanup to the platform. See Creating a cluster.

The Delete cluster action deletes the stack. The platform removes the machines, the state drive and the records. See Networking and storage.

The permissions of the cluster are the access control list of the stack. The platform stores the list, and the application keeps no separate list. See the Cluster dashboard.

Previous Architecture
Next Creating a cluster