3.1. vinfra service compute cluster create

Create a compute cluster:

vinfra service compute cluster create [--public-network <network>]
                                      [--subnet cidr=CIDR[,key=value,...]]
                                      [--cpu-model <cpu-model>] [--force]
                                      --nodes <nodes>
--public-network <network>
A physical network to connect the public virtual network to. It must include the ‘VM public’ traffic type.
--subnet cidr=CIDR[,key=value,...]

Subnet for IP address management in the public virtual network (the --public-network option is required):

  • cidr: subnet range in CIDR notation;
  • comma-separated key=value pairs with keys (optional):
    • gateway: gateway IP address;
    • dhcp: enable/disable the virtual DHCP server;
    • allocation-pool: allocation pool of IP addresses from CIDR in the format ip1-ip2, where ip1 and ip2 are starting and ending IP addresses correspondingly. Specify the key multiple times to create multiple IP pools;
    • dns-server: DNS server IP address, specify multiple times to set multiple DNS servers.

Example: --subnet cidr=192.168.5.0/24,dhcp=enable.

--cpu-model <cpu-model>
CPU model for virtual machines.
--force
Skip checks for minimal hardware requirements.
--nodes <nodes>
A comma-separated list of node IDs or hostnames.

Example:

# vinfra service compute cluster create --virtual-ip 10.94.50.244 \
--node 7ffa9540-5a20-41d1-b203-e3f349d62565,\
02ff64ae-5800-4090-b958-18b1fe8f5060,\
6e8afc28-7f71-4848-bdbe-7c5de64c5013,\
37c70bfb-c289-4794-8be4-b7a40c2b6d95,\
827a1f4e-56e5-404f-9113-88748c18f0c2 --enable-nested \
--public-network Public --subnet cidr=10.94.0.0/16,dhcp=enable,\
gateway=10.94.0.1,allocation-pool=10.94.129.64-10.94.129.79,\
dns-server=10.30.0.27,dns-server=10.30.0.28
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| task_id | be517afa-fae0-457e-819c-f4d6399f3ae2 |
+---------+--------------------------------------+

This command creates a task to create the compute cluster from five nodes specified by ID. It also specifies the virtual IP address (must belong to the network with the Compute API traffic type), the public network for VMs, the gateway, the allocation pool of IP addresses to assign to VMs, and the DNS servers to use.

Task outcome:

# vinfra task show be517afa-fae0-457e-819c-f4d6399f3ae2
+----------+-------------------------------------------------------------+
| Field    | Value                                                       |
+----------+-------------------------------------------------------------+
| args     | - admin                                                     |
| kwargs   | enable_nested: true                                         |
|          | external_network:                                           |
|          |   roles_set_id: dd42723e-1318-4f8f-9a43-b303ab09cbbe        |
|          |   subnet:                                                   |
|          |     allocation_pools:                                       |
|          |     - end_address: 10.94.129.79                             |
|          |       start_address: 10.94.129.64                           |
|          |     cidr: 10.94.0.0/16                                      |
|          |     dns_servers:                                            |
|          |     - 10.30.0.27                                            |
|          |     - 10.30.0.28                                            |
|          |     enable_dhcp: true                                       |
|          |     gateway: 10.94.0.1                                      |
|          | nodes:                                                      |
|          | - 7ffa9540-5a20-41d1-b203-e3f349d62565                      |
|          | - 02ff64ae-5800-4090-b958-18b1fe8f5060                      |
|          | - 6e8afc28-7f71-4848-bdbe-7c5de64c5013                      |
|          | - 37c70bfb-c289-4794-8be4-b7a40c2b6d95                      |
|          | - 827a1f4e-56e5-404f-9113-88748c18f0c2                      |
| name     | backend.presentation.compute.tasks.DeployComputeClusterTask |
| progress | 100                                                         |
| state    | success                                                     |
| task_id  | be517afa-fae0-457e-819c-f4d6399f3ae2                        |
+----------+-------------------------------------------------------------+