이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 4. Managing compute nodes using machine pools
4.1. About machine pools 링크 복사링크가 클립보드에 복사되었습니다!
OpenShift Dedicated uses machine pools as an elastic, dynamic provisioning method on top of your cloud infrastructure. The primary resources are machines, machine sets, and machine pools.
As of OpenShift Dedicated 4.11, the default per-pod PID limit is 4096. If you want to enable this PID limit, you must upgrade your OpenShift Dedicated clusters to this version or later. OpenShift Dedicated clusters running versions earlier than 4.11 use a default PID limit of 1024.
You cannot configure the per-pod PID limit on any OpenShift Dedicated cluster.
A machine is a fundamental unit that describes the host for a worker node. MachineSet resources are groups of compute machines. If you need more machines or must scale them down, change the number of replicas in the machine pool to which the compute machine sets belong.
Machine pools are a higher level construct to compute machine sets. A machine pool creates compute machine sets that are all clones of the same configuration across availability zones. Machine pools perform all of the host node provisioning management actions on a worker node. If you need more machines or must scale them down, change the number of replicas in the machine pool to meet your compute needs. You can manually configure scaling or set autoscaling.
By default, a cluster is created with one machine pool. You can add additional machine pools to an existing cluster, modify the default machine pool, and delete machine pools. Multiple machine pools can exist on a single cluster, and they can each have different types or different size nodes.
By default, when you create a machine pool in a multiple availability zone (Multi-AZ) cluster, that one machine pool has 3 zones. The machine pool, in turn, creates a total of 3 compute machine sets - one for each zone in the cluster. Each of those compute machine sets manages one or more machines in its respective availability zone.
If you create a new Multi-AZ cluster, the machine pools are replicated to those zones automatically. If you add a machine pool to an existing Multi-AZ, the new pool is automatically created in those zones. Similarly, deleting a machine pool will delete it from all zones. Due to this multiplicative effect, using machine pools in Multi-AZ cluster can consume more of your project’s quota for a specific region when creating machine pools.
4.1.1. Deploy a machine pool in a single availability zone within a Multi-AZ cluster 링크 복사링크가 클립보드에 복사되었습니다!
Deploy a single machine pool to a specific availability zone that is part of a Multi-AZ cluster. This option is useful when a required instance type is not available in all availability zones of a region or when your cluster does not need multiple instances of the required instance type.
Prerequisites
The OpenShift Cluster Manager API command-line interface (
ocm) is installed.ImportantOpenShift Cluster Manager API command-line interface (
ocm) is a Developer Preview feature only. For more information about the support scope of Red Hat Developer Preview features, see Developer Preview Support Scope.
Procedure
Deploy a machine pool to a specific availability zone by running the following command:
ocm create machine-pool \ --cluster <cluster_name> \ --instance-type <instance_type> \ --replicas <number_of_replicas> \ --availability-zone <availability_zone> \ [<flags>] \ <machine_pool_id>Where:
-
<cluster_name>: Replace with the name or ID of the cluster that you want to add the machine pool to. -
<instance_type>: Replace with the instance type you want to deploy to the single availability zone. -
<number_of_replicas>: Replace with the number of replicas of the selected instance type you want to include in the machine pool. -
<availability_zone>: Replace with the availability zone you want to add the machine pool to. -
<flags>: Optional. Replace with any additional flags available for machine pool creation. <machine_pool_id>: Replace with an ID for your machine pool.NoteTo view the additional flags available for machine pool creation, run the
ocm create machine-pool --helpcommand.
-
4.2. Managing compute nodes 링크 복사링크가 클립보드에 복사되었습니다!
Manage compute nodes, also known as worker nodes, in OpenShift Dedicated clusters to optimize workload placement and resource allocation. Configure machine pools to control node scaling, apply labels for workload targeting, and add taints to control pod scheduling.
4.2.1. Creating a machine pool 링크 복사링크가 클립보드에 복사되었습니다!
A machine pool is created when you install an OpenShift Dedicated cluster. After installation, you can create additional machine pools for your cluster by using OpenShift Cluster Manager.
The compute, also known as worker, node instance types, autoscaling options, and node counts that are available depend on your OpenShift Dedicated subscriptions, resource quotas and deployment scenario. For more information, contact your sales representative or Red Hat support.
Prerequisites
- You created an OpenShift Dedicated cluster.
Procedure
- Navigate to OpenShift Cluster Manager and select your cluster.
- Under the Machine pools tab, click Add machine pool.
- Add a Machine pool name.
Select a Compute node instance type from the list. The instance type defines the vCPU and memory allocation for each compute node in the machine pool.
NoteYou cannot change the instance type for a machine pool after the pool is created.
Configure the node count by choosing one of the following options:
Enable autoscaling: Select Enable autoscaling to automatically scale the number of machines in your machine pool to meet the deployment needs. Set the minimum and maximum node count limits for autoscaling. The cluster autoscaler does not reduce or increase the machine pool node count beyond the limits that you specify.
NoteThe Enable autoscaling option is only available for OpenShift Dedicated if you have the
capability.cluster.autoscale_clusterssubscription. For more information, contact your sales representative or Red Hat support.- If you deployed your cluster using a single availability zone, set the Minimum and maximum node count. This defines the minimum and maximum compute node limits in the availability zone.
- If you deployed your cluster using multiple availability zones, set the Minimum nodes per zone and Maximum nodes per zone. This defines the minimum and maximum compute node limits per zone.
Manual node count: If you do not enable autoscaling, select a compute node count:
- If you deployed your cluster using a single availability zone, select a Compute node count from the drop-down menu. This defines the number of compute nodes to provision to the machine pool for the zone.
- If you deployed your cluster using multiple availability zones, select a Compute node count (per zone) from the drop-down menu. This defines the number of compute nodes to provision to the machine pool per zone.
Optional: Configure advanced machine pool settings by expanding the appropriate sections and providing values:
- For Node labels and taints, expand the Edit node labels and taints menu.
- Under Node labels, add Key and Value entries for your node labels.
Under Taints, add Key and Value entries for your taints. For each taint, select an Effect from the drop-down menu. Available options include
NoSchedule,PreferNoSchedule, andNoExecute.NoteCreating a machine pool with taints is only possible if the cluster already has at least one machine pool without a taint. Alternatively, you can add node labels and taints after you create the machine pool.
- Custom security groups: Select additional custom security groups to use for nodes in this machine pool. You must have already created the security groups and associated them with the VPC that you selected for this cluster. You cannot add or edit security groups after you create the machine pool. For more information, see the requirements for security groups in the "Additional resources" section.
- Amazon EC2 Spot Instances: If you deployed OpenShift Dedicated on AWS using the Customer Cloud Subscription (CCS) model and want to configure your machine pool to deploy machines as non-guaranteed AWS Spot Instances, select Use Amazon EC2 Spot Instances. Leave Use On-Demand instance price selected to use the on-demand instance price, or select Set maximum price to define a maximum hourly price for a Spot Instance. For more information about Amazon EC2 Spot Instances, see the AWS documentation.
- Click Add machine pool to create the machine pool.
Verification
- Verify that the machine pool is visible on the Machine pools page and the configuration is as expected.
4.2.2. Deleting a machine pool 링크 복사링크가 클립보드에 복사되었습니다!
You can delete a machine pool if your workload requirements have changed and your current machine pools no longer meet your needs. You can delete machine pools by using Red Hat OpenShift Cluster Manager.
Prerequisites
- You have created an OpenShift Dedicated cluster.
- The cluster is in the ready state.
- You have an existing machine pool without any taints and with at least two replicas for a Single-AZ cluster or three replicas for a Multi-AZ cluster.
Procedure
- From OpenShift Cluster Manager, navigate to the Cluster List page and select the cluster that contains the machine pool that you want to delete.
- On the selected cluster, select the Machine pools tab.
-
Under the Machine pools tab, click the Options menu
for the machine pool that you want to delete.
- Click Delete.
Verification
- Verify that the machine pool no longer is displayed in the list of machine pools on the Machine pools tab.
4.2.3. Scale compute nodes manually 링크 복사링크가 클립보드에 복사되었습니다!
If you have not enabled autoscaling for your machine pool, you can manually scale the number of compute nodes, also known as worker nodes, in the pool to meet your deployment needs. You must scale each machine pool separately.
Prerequisites
- You created an OpenShift Dedicated cluster.
- You have an existing machine pool.
Procedure
- Navigate to OpenShift Cluster Manager and select your cluster.
-
Under the Machine pools tab, click the Options menu
for the machine pool that you want to scale.
- Select Scale.
Specify the node count:
- If you deployed your cluster using a single availability zone, specify the Node count in the drop-down menu.
If you deployed your cluster using multiple availability zones, specify the Node count per zone in the drop-down menu.
NoteYour subscription determines the number of nodes that you can select.
- Click Apply to scale the machine pool.
Verification
- Under the Machine pools tab, verify that the Node count for your machine pool is as expected.
4.2.4. Node labels for managing machine pools in OpenShift Dedicated 링크 복사링크가 클립보드에 복사되었습니다!
A label is a key-value pair applied to a Node object. You can use labels to organize sets of objects and control the scheduling of pods. You can add labels during cluster creation or after. Labels can be modified or updated at any time.
4.2.4.1. Add node labels to a machine pool 링크 복사링크가 클립보드에 복사되었습니다!
Add or edit labels for compute nodes at any time to manage the nodes in a manner that is relevant to you. For example, you can assign types of workloads to specific nodes. Each key must be unique to the object it is assigned to.
Prerequisites
- You created an OpenShift Dedicated cluster.
- You have an existing machine pool.
Procedure
- Navigate to OpenShift Cluster Manager and select your cluster.
-
Under the Machine pools tab, click the Options menu
for the machine pool that you want to add a label to.
- Select Edit labels.
- If you have existing labels in the machine pool that you want to remove, select x next to the label to delete it.
-
Add a label using the format
<key>=<value>and press enter. For example, addapp=dband then press Enter. If the format is correct, the key value pair is then highlighted. - Repeat the previous step if you want to add additional labels.
- Click Save to apply the labels to the machine pool.
Verification
- Under the Machine pools tab, select > next to your machine pool to expand the view.
- Verify that your labels are listed under Labels in the expanded view.
4.2.5. Add taints to a machine pool 링크 복사링크가 클립보드에 복사되었습니다!
You can add taints for compute nodes in a machine pool to control which pods are scheduled to them. When you apply a taint to a machine pool, the scheduler cannot place a pod on the nodes in the pool unless the pod specification includes a toleration for the taint.
A cluster must have at least one machine pool that does not contain any taints.
Prerequisites
- You created an OpenShift Dedicated cluster.
- You have an existing machine pool that does not contain any taints and contains at least two instances.
Procedure
- Navigate to OpenShift Cluster Manager and select your cluster.
-
Under the Machine pools tab, click the Options menu
for the machine pool that you want to add a taint to.
- Select Edit taints.
- Add Key and Value entries for your taint.
-
Select an Effect for your taint from the list. Available options include
NoSchedule,PreferNoSchedule, andNoExecute. - Select Add taint if you want to add more taints to the machine pool.
- Click Save to apply the taints to the machine pool.
Verification
- Under the Machine pools tab, select > next to your machine pool to expand the view.
- Verify that your taints are listed under Taints in the expanded view.
4.3. Managing cluster autoscaling 링크 복사링크가 클립보드에 복사되었습니다!
Configure cluster autoscaling to automatically adjust the number of worker nodes based on workload demands. Enable autoscaling for specific machine pools to optimize resource utilization and reduce costs.
Autoscaling is available only on clusters that were purchased through Google Cloud Marketplace.
When you enable autoscaling, you must also set a minimum and maximum number of worker nodes.
Only cluster owners and organization admins can scale or delete a cluster.
Applying autoscaling to an OpenShift Dedicated cluster involves deploying a cluster autoscaler and then deploying machine autoscalers for each machine type in your cluster.
You can configure the cluster autoscaler only in clusters where the Machine API is operational.
You can enable autoscaling on worker nodes to increase or decrease the number of nodes available by editing the machine pool definition for an existing cluster. You can also disable autoscaling on worker nodes by using OpenShift Cluster Manager console.
Enable autoscaling for worker nodes in the machine pool definition from OpenShift Cluster Manager console.
Procedure
- From OpenShift Cluster Manager, navigate to the Cluster List page and select the cluster that you want to enable autoscaling for.
- On the selected cluster, select the Machine pools tab.
-
Click the Options menu
at the end of the machine pool that you want to enable autoscaling for and select Edit.
- On the Edit machine pool dialog, select the Enable autoscaling checkbox.
- Select Save to save these changes and enable autoscaling for the machine pool.
Disable autoscaling for worker nodes in the machine pool definition from OpenShift Cluster Manager.
Procedure
- From OpenShift Cluster Manager, navigate to the Cluster List page and select the cluster with autoscaling that must be disabled.
- On the selected cluster, select the Machine pools tab.
-
Click the Options menu
at the end of the machine pool with autoscaling and select Edit.
- On the Edit machine pool dialog, clear the Enable autoscaling checkbox.
- Select Save to save these changes and disable autoscaling from the machine pool.
4.3.3. The cluster autoscaler 링크 복사링크가 클립보드에 복사되었습니다!
The cluster autoscaler adjusts the size of an OpenShift Dedicated cluster to meet its current deployment needs. It uses declarative, Kubernetes-style arguments to provide infrastructure management that does not rely on objects of a specific cloud provider.
The cluster autoscaler increases the size of the cluster when there are pods that fail to schedule on any of the current worker nodes due to insufficient resources or when another node is necessary to meet deployment needs. The cluster autoscaler does not increase the cluster resources beyond the limits that you specify.
The cluster autoscaler computes the total memory and CPU on all nodes the cluster, even though it does not manage the control plane nodes. These values are not single-machine oriented. They are an aggregation of all the resources in the entire cluster. For example, if you set the maximum memory resource limit, the cluster autoscaler includes all the nodes in the cluster when calculating the current memory usage. That calculation is then used to determine if the cluster autoscaler has the capacity to add more worker resources.
Ensure that the maxNodesTotal value in the ClusterAutoscaler custom resource (CR) that you create is large enough to account for the total possible number of machines in your cluster. This value must encompass the number of control plane machines and the possible number of compute machines that you might scale to.
4.3.3.1. Automatic node removal 링크 복사링크가 클립보드에 복사되었습니다!
Every 10 seconds, the cluster autoscaler checks which nodes are unnecessary in the cluster and removes them. The cluster autoscaler considers a node for removal if the following conditions apply:
-
The node utilization is less than the node utilization level threshold for the cluster. The node utilization level is the sum of the requested resources divided by the allocated resources for the node. If you do not specify a value in the
ClusterAutoscalercustom resource, the cluster autoscaler uses a default value of0.5, which corresponds to 50% utilization. - The cluster autoscaler can move all pods running on the node to the other nodes. The Kubernetes scheduler is responsible for scheduling pods on the nodes.
- The cluster autoscaler does not have scale down disabled annotation.
If the following types of pods are present on a node, the cluster autoscaler will not remove the node:
- Pods with restrictive pod disruption budgets (PDBs).
- Kube-system pods that do not run on the node by default.
- Kube-system pods that do not have a PDB or have a PDB that is too restrictive.
- Pods that are not backed by a controller object such as a deployment, replica set, or stateful set.
- Pods with local storage.
- Pods that cannot be moved elsewhere because of a lack of resources, incompatible node selectors or affinity, matching anti-affinity, and so on.
-
Unless they also have a
"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"annotation, pods that have a"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"annotation.
For example, you set the maximum CPU limit to 64 cores and configure the cluster autoscaler to only create machines that have 8 cores each. If your cluster starts with 30 cores, the cluster autoscaler can add up to 4 more nodes with 32 cores, for a total of 62.
By default, when the cluster autoscaler removes a node, it does not cordon the node when draining the pods from the node. You can configure the cluster autoscaler to cordon the node before draining and moving the pods by setting the spec.scaleDown.cordonNodeBeforeTerminating parameter to enabled in the ClusterAutoscaler CR. This parameter is disabled by default. It is recommended to enable this parameter in production clusters because of the risk of data loss, application errors, pods getting stuck in the terminating state, or other issues if the cluster autoscaler removes a node when the parameter is disabled. Leaving this parameter disabled, which can result in faster node removal, might be appropriate in clusters that run only stateless workloads.
4.3.3.2. Limitations 링크 복사링크가 클립보드에 복사되었습니다!
If you configure the cluster autoscaler, additional usage restrictions apply:
- Do not modify the nodes that are in autoscaled node groups directly. All nodes within the same node group have the same capacity and labels and run the same system pods.
- Specify requests for your pods.
- If you have to prevent pods from being deleted too quickly, configure appropriate PDBs.
- Confirm that your cloud provider quota is large enough to support the maximum node pools that you configure.
- Do not run additional node group autoscalers, especially the ones offered by your cloud provider.
The cluster autoscaler only adds nodes in autoscaled node groups if doing so would result in a schedulable pod. If the available node types cannot meet the requirements for a pod request, or if the node groups that could meet these requirements are at their maximum size, the cluster autoscaler cannot scale up.
4.3.3.3. Interaction with other scheduling features 링크 복사링크가 클립보드에 복사되었습니다!
The horizontal pod autoscaler (HPA) and the cluster autoscaler modify cluster resources in different ways. The HPA changes the deployment’s or replica set’s number of replicas based on the current CPU load. If the load increases, the HPA creates new replicas, regardless of the amount of resources available to the cluster. If there are not enough resources, the cluster autoscaler adds resources so that the HPA-created pods can run. If the load decreases, the HPA stops some replicas. If this action causes some nodes to be underutilized or completely empty, the cluster autoscaler deletes the unnecessary nodes.
The cluster autoscaler takes pod priorities into account. The Pod Priority and Preemption feature enables scheduling pods based on priorities if the cluster does not have enough resources, but the cluster autoscaler ensures that the cluster has resources to run all pods. To honor the intention of both features, the cluster autoscaler includes a priority cutoff function. You can use this cutoff to schedule "best-effort" pods, which do not cause the cluster autoscaler to increase resources but instead run only when spare resources are available.
Pods with priority lower than the cutoff value do not cause the cluster to scale up or prevent the cluster from scaling down. No new nodes are added to run the pods, and nodes running these pods might be deleted to free resources.