2.7. Creating a compute machine set on Nutanix
You can create a different compute machine set to serve a specific purpose in your OpenShift Container Platform cluster on Nutanix. For example, you might create infrastructure machine sets and related machines so that you can move supporting workloads to the new machines, which helps ensure efficient resource allocation.
You can use the advanced machine management and scaling capabilities only in clusters where the Machine API is operational. Clusters with user-provisioned infrastructure require additional validation and configuration to use the Machine API.
Clusters with the infrastructure platform type none cannot use the Machine API. This limitation applies even if the compute machines that are attached to the cluster are installed on a platform that supports the feature. This parameter cannot be changed after installation.
To view the platform type for your cluster, run the following command:
$ oc get infrastructure cluster -o jsonpath='{.status.platform}'
2.7.1. Sample YAML for a compute machine set custom resource on Nutanix 링크 복사링크가 클립보드에 복사되었습니다!
You can use a YAML file to automate node provisioning and ensure workloads are scheduled correctly based on role and infrastructure requirements.
The sample YAML shows how to define a Nutanix compute MachineSet for your cluster. It explains how to configure roles, labels, sizing, networking, and boot settings so new nodes are created consistently.
The sample YAML defines a Nutanix compute machine set that creates nodes that are labeled with node-role.kubernetes.io/<role>: "".
In the sample, <infrastructure_id> is the infrastructure ID label that is based on the cluster ID that you set when you provisioned the cluster, and <role> is the node label to add.
2.7.1.1. Values obtained by using the OpenShift CLI 링크 복사링크가 클립보드에 복사되었습니다!
In the following example, you can obtain some of the values for your cluster by using the OpenShift CLI (oc).
- Infrastructure ID
The
<infrastructure_id>string is the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster. If you have the OpenShift CLI installed, you can obtain the infrastructure ID by running the following command:$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
labels:
machine.openshift.io/cluster-api-cluster: <infrastructure_id>
machine.openshift.io/cluster-api-machine-role: <role>
machine.openshift.io/cluster-api-machine-type: <role>
name: <infrastructure_id>-<role>-<zone>
namespace: openshift-machine-api
annotations:
machine.openshift.io/memoryMb: "16384"
machine.openshift.io/vCPU: "4"
spec:
replicas: 3
selector:
matchLabels:
machine.openshift.io/cluster-api-cluster: <infrastructure_id>
machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>-<zone>
template:
metadata:
labels:
machine.openshift.io/cluster-api-cluster: <infrastructure_id>
machine.openshift.io/cluster-api-machine-role: <role>
machine.openshift.io/cluster-api-machine-type: <role>
machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>-<zone>
spec:
metadata:
labels:
node-role.kubernetes.io/<role>: ""
providerSpec:
value:
apiVersion: machine.openshift.io/v1
bootType: ""
categories:
- key: <category_name>
value: <category_value>
cluster:
type: uuid
uuid: <cluster_uuid>
credentialsSecret:
name: nutanix-credentials
image:
name: <infrastructure_id>-rhcos
type: name
kind: NutanixMachineProviderConfig
memorySize: 16Gi
project:
type: name
name: <project_name>
subnets:
- type: uuid
uuid: <subnet_uuid>
systemDiskSize: 120Gi
userDataSecret:
name: <user_data_secret>
vcpuSockets: 4
vcpusPerSocket: 1
where:
<infrastructure_id>- Specifies the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster.
<role>- Specifies the node label to add.
<infrastructure_id>-<infra>-<region>- Specifies the infrastructure ID, node label, and zone.
annotations- Specifies annotations for the cluster autoscaler.
bootTypeSpecifies the boot type that the compute machines use. For more information about boot types, see Understanding UEFI, Secure Boot, and TPM in the Virtualized Environment. Valid values are
Legacy,SecureBoot, orUEFI. The default isLegacy.참고You must use the
Legacyboot type in OpenShift Container Platform 4.21.<categories>-
Specifies one or more Nutanix Prism categories to apply to compute machines. This stanza requires
keyandvalueparameters for a category key-value pair that exists in Prism Central. For more information about categories, see Category management. <cluster>-
Specifies a Nutanix Prism Element cluster configuration. In this example, the cluster type is
uuid, so there is auuidstanza. <infrastructure_id>-rhcos- Specifies the image to use. Use an image from an existing default compute machine set for the cluster.
16Gi- Specifies the amount of memory for the cluster in Gi.
project-
Specifies the Nutanix project that you use for your cluster. In this example, the project type is
name, so there is anamestanza. subnets- Specifies one or more UUID for the Prism Element subnet object. The CIDR IP address prefix for one of the specified subnets must contain the virtual IP addresses that the OpenShift Container Platform cluster uses. A maximum of 32 subnets for each Prism Element failure domain in the cluster is supported. All subnet UUID values must be unique.
120Gi- Specifies the size of the system disk in Gi.
<user_data_secret>-
Specifies the name of the secret in the user data YAML file that is in the
openshift-machine-apinamespace. Use the value that installation program populates in the default compute machine set. 4- Specifies the number of vCPU sockets.
1- Specifies the number of vCPUs per socket.