×

Managing machines with the Cluster API is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

You can change the configuration of your VMware vSphere Cluster API machines by updating values in the Cluster API custom resource manifests.

Sample YAML for configuring VMware vSphere clusters

The following example YAML files show configurations for a VMware vSphere cluster.

Sample YAML for a Cluster API infrastructure resource on VMware vSphere

The infrastructure resource is provider-specific and defines properties that are shared by all the compute machine sets in the cluster, such as the region and subnets. The compute machine set references this resource when creating machines.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereCluster (1)
metadata:
  name: <cluster_name> (2)
spec:
  controlPlaneEndpoint: (3)
    host: <control_plane_endpoint_address>
    port: 6443
  identityRef:
    kind: Secret
    name: <cluster_name>
  server: <vsphere_server> (4)
1 Specify the infrastructure kind for the cluster. This value must match the value for your platform.
2 Specify the cluster ID as the name of the cluster.
3 Specify the IP address of the control plane endpoint and the port used to access it.
4 Specify the vSphere server for the cluster. You can find this value on an existing vSphere cluster by running the following command:
$ oc get infrastructure cluster \
  -o jsonpath="{.spec.platformSpec.vsphere.vcenters[0].server}"

Sample YAML for a Cluster API machine template resource on VMware vSphere

The machine template resource is provider-specific and defines the basic properties of the machines that a compute machine set creates. The compute machine set references this template when creating machines.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereMachineTemplate (1)
metadata:
  name: <template_name> (2)
  namespace: openshift-cluster-api
spec:
  template:
    spec: (3)
      template: <vm_template_name> (4)
      server: <vcenter_server_ip> (5)
      diskGiB: 128
      cloneMode: linkedClone (6)
      datacenter: <vcenter_data_center_name> (7)
      datastore: <vcenter_datastore_name> (8)
      folder: <vcenter_vm_folder_path> (9)
      resourcePool: <vsphere_resource_pool> (10)
      numCPUs: 4
      memoryMiB: 16384
      network:
        devices:
        - dhcp4: true
          networkName: "<vm_network_name>" (11)
1 Specify the machine template kind. This value must match the value for your platform.
2 Specify a name for the machine template.
3 Specify the details for your environment. The values here are examples.
4 Specify the vSphere VM template to use, such as user-5ddjd-rhcos.
5 Specify the vCenter server IP or fully qualified domain name.
6 Specify the type of VM clone to use. The following values are valid:
  • fullClone

  • linkedClone

When using the linkedClone type, the disk size matches the clone source instead of using the diskGiB value. For more information, see the vSphere documentation about VM clone types.

7 Specify the vCenter data center to deploy the compute machine set on.
8 Specify the vCenter datastore to deploy the compute machine set on.
9 Specify the path to the vSphere VM folder in vCenter, such as /dc1/vm/user-inst-5ddjd.
10 Specify the vSphere resource pool for your VMs.
11 Specify the vSphere VM network to deploy the compute machine set to. This VM network must be where other compute machines reside in the cluster.

Sample YAML for a Cluster API compute machine set resource on VMware vSphere

The compute machine set resource defines additional properties of the machines that it creates. The compute machine set also references the infrastructure resource and machine template when creating machines.

apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineSet
metadata:
  name: <machine_set_name> (1)
  namespace: openshift-cluster-api
spec:
  clusterName: <cluster_name> (2)
  replicas: 1
  selector:
    matchLabels:
      test: example
  template:
    metadata:
      labels:
        test: example
    spec:
      bootstrap:
         dataSecretName: worker-user-data (3)
      clusterName: <cluster_name>
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
        kind: VSphereMachineTemplate (4)
        name: <template_name> (5)
      failureDomain: (6)
        - name: <failure_domain_name>
          region: <region_a>
          zone: <zone_a>
          server: <vcenter_server_name>
          topology:
            datacenter: <region_a_data_center>
            computeCluster: "</region_a_data_center/host/zone_a_cluster>"
            resourcePool: "</region_a_data_center/host/zone_a_cluster/Resources/resource_pool>"
            datastore: "</region_a_data_center/datastore/datastore_a>"
            networks:
            - port-group
1 Specify a name for the compute machine set.
2 Specify the cluster ID as the name of the cluster.
3 For the Cluster API Technology Preview, the Operator can use the worker user data secret from the openshift-machine-api namespace.
4 Specify the machine template kind. This value must match the value for your platform.
5 Specify the machine template name.
6 Specify the failure domain configuration details.

Using multiple regions and zones on a vSphere cluster that uses the Cluster API is not a validated configuration.