Layouts

The layout defines how cluster nodes are placed in the zVirt infrastructure. Only the Standard layout is supported. The layout is set with the layout parameter in the ModuleConfig resource of the cloud-provider-zvirt module.

Standard

In the Standard layout, all cluster nodes are created in a single zVirt cluster. Key features of the layout:

  • Virtual machines are created in the zVirt cluster set with the clusterID parameter.
  • The zVirt cluster must have shared storage domains available to all its hosts and CPUs of the same type.
  • Virtual machines are cloned from a template prepared from a cloud image.
  • The virtual machine network interface is created from the vNIC profile set with the vnicProfileID parameter of the ZvirtInstanceClass resource.
  • Deckhouse Platform creates and deletes the node virtual machines via the zVirt API.

Standard layout in zVirt

Example of the layout configuration:

apiVersion: deckhouse.io/v1alpha1
kind: ModuleConfig
metadata:
  name: cloud-provider-zvirt
spec:
  version: 2
  enabled: true
  settings:
    provider:
      parameters:
        server: <ZVIRT_API_URL>
        clusterID: <CLUSTER_ID>
    nodes:
      parameters:
        layout: Standard
        sshPublicKey: <SSH_PUBLIC_KEY>

Configuration

The zVirt cloud provider parameters are set in four resources:

  • The ModuleConfig of the cloud-provider-zvirt module sets the layout, the zVirt API connection parameters, and the zVirt cluster to create virtual machines in.
  • The d8-credentials Secret in the d8-cloud-provider-zvirt namespace stores the zVirt user login and password in the format covered in the “Credentials Secret” section.
  • ZvirtInstanceClass describes the virtual machine parameters.
  • NodeGroup describes the node groups and references the instance class. Master nodes are described by the master node group with the CloudPermanent type.

To change the provider settings in a running cluster, edit the ModuleConfig:

d8 k edit mc cloud-provider-zvirt

To apply the changes to the master nodes and the nodes of CloudPermanent groups, run the following command:

dhctl converge

If the cluster was installed with the ZvirtClusterConfiguration schema, it must be migrated to the ModuleConfig-based configuration. Until the migration is complete, the D8CloudProviderZvirtMigrationPending alert may fire and Deckhouse Platform updates may be blocked.

The migration procedure is described in “How to migrate a cloud provider to ModuleConfig-based configuration?”.

Configuration example

Below is a minimal configuration of a cluster with the Standard layout, one master node, and one group of worker nodes:

apiVersion: deckhouse.io/v1alpha1
kind: ModuleConfig
metadata:
  name: cloud-provider-zvirt
spec:
  version: 2
  enabled: true
  settings:
    provider:
      parameters:
        server: <ZVIRT_API_URL>
        clusterID: <CLUSTER_ID>
    nodes:
      parameters:
        layout: Standard
        sshPublicKey: <SSH_PUBLIC_KEY>
---
apiVersion: v1
kind: Secret
metadata:
  name: d8-credentials
  namespace: d8-cloud-provider-zvirt
type: cloud-provider.deckhouse.io/credentials
stringData:
  authScheme: userPassword
  identity: <USERNAME>
  secret: <PASSWORD>
---
apiVersion: deckhouse.io/v1
kind: ZvirtInstanceClass
metadata:
  name: master
spec:
  numCPUs: 4
  memory: 8192
  rootDiskSizeGb: 50
  etcdDiskSizeGb: 10
  template: <TEMPLATE_NAME>
  vnicProfileID: <VNIC_PROFILE_ID>
  storageDomainID: <STORAGE_DOMAIN_ID>
---
apiVersion: deckhouse.io/v1
kind: NodeGroup
metadata:
  name: master
spec:
  nodeType: CloudPermanent
  cloudInstances:
    classReference:
      kind: ZvirtInstanceClass
      name: master
    minPerZone: 1
    maxPerZone: 1
---
apiVersion: deckhouse.io/v1
kind: ZvirtInstanceClass
metadata:
  name: worker
spec:
  numCPUs: 4
  memory: 8192
  template: <TEMPLATE_NAME>
  vnicProfileID: <VNIC_PROFILE_ID>
---
apiVersion: deckhouse.io/v1
kind: NodeGroup
metadata:
  name: worker
spec:
  nodeType: CloudEphemeral
  cloudInstances:
    classReference:
      kind: ZvirtInstanceClass
      name: worker
    minPerZone: 1
    maxPerZone: 3

Where:

  • ZVIRT_API_URL: URL of the zVirt API endpoint (the server parameter), for example, https://zvirt.example.com/ovirt-engine/api.
  • CLUSTER_ID: ID of the zVirt cluster to create virtual machines in (the clusterID parameter).
  • SSH_PUBLIC_KEY: Public SSH key for accessing the nodes (the sshPublicKey parameter).
  • USERNAME and PASSWORD: zVirt user login and password for the credentials Secret.
  • TEMPLATE_NAME: Name of the virtual machine template prepared as described in the “Preparing a virtual machine template” section.
  • VNIC_PROFILE_ID: ID of the vNIC profile used to create the virtual machine network interface.
  • STORAGE_DOMAIN_ID: ID of the zVirt storage domain to create the etcd disk in.

The number of master nodes is set with the minPerZone parameter of the master node group. In the ZvirtInstanceClass resource of the master group, set the etcdDiskSizeGb and storageDomainID parameters, which set the size and the storage domain of a separate disk for etcd. The etcdDiskSizeGb parameter cannot be set in the instance classes of other CloudPermanent groups.

If the zVirt API uses a self-signed certificate, pass the CA certificate in the caBundle parameter or set the insecure parameter to true.

The other parameters are described in the module settings and in the ZvirtInstanceClass resource description.

The clusterID, vnicProfileID, and storageDomainID values can be obtained via the zVirt API or the Administration Portal. Getting the vNIC profile ID via the API is described in the “How to get the vNIC profile ID?” section.

Static network configuration of nodes

Nodes whose group has no static network configuration get their network settings over DHCP. To assign static IP addresses to the nodes of CloudPermanent groups, set the customNetworkConfigs parameter in the nodes.parameters section of the ModuleConfig resource. The parameter key sets the node group name, and the value sets the network interface configuration of the nodes in this group.

Example of the static network configuration for the master group of three nodes:

apiVersion: deckhouse.io/v1alpha1
kind: ModuleConfig
metadata:
  name: cloud-provider-zvirt
spec:
  version: 2
  settings:
    nodes:
      parameters:
        customNetworkConfigs:
          master:
            networkInterfaceName: enp1s0
            networkInterfaceAddresses:
              - 192.168.1.10
              - 192.168.1.11
              - 192.168.1.12
            networkInterfaceNetmask: 255.255.255.0
            networkInterfaceGateway: 192.168.1.1
            dnsServers:
              - 192.168.1.2

Addresses from the networkInterfaceAddresses list are assigned to the group nodes in order, one address per node, so specify an address for each node of the group. Duplicate addresses in the list are not allowed.

If you change the network settings of existing nodes in the customNetworkConfigs parameter, dhctl converge recreates the virtual machines of these nodes.

Additional resources