This script allows to deploy nested Virtuozzo Hybrid Infrastructure cluster (VHI) for test/dev automatically. Cluster can be deployed on top of any VHI cluster with nested virtualization enabled.
- Cluster must have a nested virtualization enabled:
- Enable nested virtualization for the physical host:
- Connect to your physical VHI node via SSH.
- Open the
/etc/modprobe.d/dist.conf
file. - Add the following line:
- [For Intel-based systems] Add this line:
options kvm_intel nested=y
- [For AMD-based systems] Add this line:
options kvm_amd nested=y
- [For Intel-based systems] Add this line:
- [For AMD-based systems only] Add the
svm
flag to your CPU model. For example:# vinfra service compute set --cpu-model EPYC-IBPB --cpu-features svm
- Reboot the host.
- VMs should be created only after that. To check if nested virtualization is enabled:
- For a physical server:
- [For Intel-based systems] Run this command on the node:
# cat /sys/module/kvm_intel/parameters/nested
- [For AMD-based systems] Run this command on the node:
# cat /sys/module/kvm_amd/parameters/nested
- [For Intel-based systems] Run this command on the node:
- For a virtual machine, run this command inside the VM:
# cat /proc/cpuinfo | grep vmx
- For a physical server:
- Enable nested virtualization for the physical host:
- Cluster must have a public and private networks configured. Private network should not have a default gateway.
- Cluster must have flavors “vhimaster” (16 vCPU, 42GB RAM) and "vhislave" (16 vCPU, 32GB RAM) with at least 8 vCPU and 24GB RAM. We use these flavors by default.
- Upload the latest VHI qcow2 template to your cluster via Admin UI or CLI (faster):
- Login to your physical VHI cluster master node via SSH.
- Download the latest VHI qcow2 template:
# wget https://virtuozzo.s3.amazonaws.com/vzlinux-iso-hci-latest.qcow2
- Create an image:
# vinfra service compute image create vhi-latest --disk-format qcow2 --container-format bare --file vzlinux-iso-hci-latest.qcow2 --public --wait
- Install OpenStack CLI on your computer https://docs.openstack.org/newton/user-guide/common/cli-install-openstack-command-line-clients.html For example, for MacOS:
# brew install openstackclient
- Download scripts to your computer:
# git clone https://github.com/virtuozzo/vhideploy.git
- Create/edit OpenStack source file based on the provided example.
# vi project.sh
OS_PROJECT_DOMAIN_NAME - the name of the domain to deploy the stack; OS_USER_DOMAIN_NAME - the name of the user domain; OS_PROJECT_NAME - the name of the project to deploy the stack; OS_USERNAME - user name; OS_PASSWORD - user password; OS_AUTH_URL - the url of OpenStack endpoint, endpoint must be published and available.
- Load source file:
# source project.sh
- Check that connection to OpenStack API works:
# openstack --insecure server list // use --insecure option if your cluster uses a self-signed certificate
- Read about OpenStack Heat https://docs.openstack.org/heat/latest/
- Connect to OpenStack CLI remotly.
- Deploy heat stack:
The minimal required configuration:
# openstack --insecure stack create stack_name -t vip.yaml --parameter image="vhi-latest" --parameter stack_type="hacompute" --parameter private_network="private" --parameter slave_count="2" --parameter compute_addons="k8saas,lbaas" --parameter cluster_password="Virtuozzo1"
Here:# openstack --insecure stack create stack_name -t vip.yaml --parameter image="vhi-latest" --parameter stack_type="compute" --parameter private_network="private" --parameter slave_count="2" --parameter cluster_password="Virtuozzo1"
- stack_name - just an OpenStack Heat stack name;
- image - the name of the source image, image must be qcow2;
- private_network - the name of the private (virtual) network, virtual network must be connected with public network via virtual router with SNAT;
- public_network - the name of the public (physical) network, this network must have DHCP enabled and DNS configured, default name - “public”;
- slave_count - number of cluster nodes in addition to management nodes; for HA configuration, the minimal slave count must be 2;
- stack_type - VHI deployment mode: compute - cluster with storage and compute roles; hacompute - cluster with storage and compute roles, management nodes with HA.
- master_flavor - flavor to use for VHI master nodes.
- slave_flavor - flavor to use for VHI slave nodes.
- storage_policy - storage policy name.
- compute_addons - what addons should be automatically installed after cluster deployment.
- Check stack status:
# openstack --insecure stack list
- Wait at least for 10 minutes for cluster to be deployed. After that go to the master node public IP in your browser https://<master_ip>:8888 with provided password. Check the compute cluster and other services status.
- Reconfigure the Public network:
- Go to Admin UI→Compute→Network
- Delete the network “public”.
- Create a new network:
- Type: physical
- Name: public
- Infrastructure network: Public
- Untagged
- Subnet:
- IPv4
- CIDR, GW and DNS must be configured.
- Access: All projects, Full
- Enjoy.
- Connect to OpenStack CLI: https://docs.virtuozzo.com/virtuozzo_hybrid_infrastructure_6_2_admins_guide/index.html#connecting-to-openstack-command-line-interface.html
- Configure OpenStack endpoint if needed: https://docs.virtuozzo.com/virtuozzo_hybrid_infrastructure_6_2_admins_guide/index.html#setting-dns-name-for-the-compute-api.html