Chapter 4. Resizing a cluster (Technology Preview)
You can customize your managed cluster specifications, such as virtual machine sizes and number of nodes.
Many clusters that are managed by Red Hat Advanced Cluster Management for Kubernetes can be scaled by using Red Hat Advanced Cluster Management console or command line, and the MachinePool
resource. A MachinePool
resource is a Kubernetes resource on the Hub cluster that groups the MachineSet
resources together on the managed cluster. The MachinePool
resource uniformly configures a set of machine resources, including zone configurations, instance type, and root storage. It also helps you manually configure the desired number of nodes or configure auto-scaling of nodes on the managed cluster.
4.1. Scaling managed clusters created by Red Hat Advanced Cluster Management
Scaling clusters that were created by Red Hat Advanced Cluster Management using the MachinePool
resource is a Technology Preview feature that is not supported for bare metal clusters that were created by Red Hat Advanced Cluster Management.
4.1.1. Autoscaling
Configuring autoscaling provides the flexibility of your cluster to scale as needed to lower your cost of resources by scaling down when traffic is low, and by scaling up to ensure that there are enough resources when there is a higher demand for resources.
4.1.1.1. Enabling autoscaling
To enable autoscaling on your
MachinePool
resources using the Red Hat Advanced Cluster Management console, complete the following steps:- In the Red Hat Advanced Cluster Management navigation, select Infrastructure > Clusters.
- Click the name of your target cluster to view the details about the cluster.
- Select the Machine pools tab to view the machine pool information.
- From the machine pools page, select Enable autoscale from the Options menu for the target machine pool.
- Select the minimum and maximum number of machine set replicas. A machine set replica maps directly to a node on the cluster.
Click Scale to submit the changes.
The changes might take several minutes to reflect on the console. You can view the status of the scaling operation by clicking View machines if the notification of the Machine pools tab.
To enable autoscaling on your
MachinePool
resources using the command line, complete the following steps:Enter the following command to view your list of machine pools:
oc get machinepools -n <managed-cluster-namespace>
Replace
managed-cluster-namespace
with the namespace of your target managed cluster.Enter the following command to edit the YAML file for the machine pool:
oc edit machinepool <name-of-MachinePool-resource> -n <namespace-of-managed-cluster>
Replace
name-of-MachinePool-resource
with the name of yourMachinePool
resource.Replace
namespace-of-managed-cluster
with the name of the namespace of your managed cluster.-
Delete the
spec.replicas
field from the YAML file. -
Add the
spec.autoscaling.minReplicas
setting andspec.autoscaling.maxReplicas
fields to the resource YAML. -
Add the minimum number of replicas to the
minReplicas
setting. -
Add the maximum number of replicas into the
maxReplicas
setting. - Save the file to submit the changes.
Autoscaling is enabled for the machine pool.
4.1.1.2. Disabling autoscaling
You can disable autoscaling by using the console or the command line.
To disable autoscaling by using the Red Hat Advanced Cluster Management console, complete the following steps:
- In the Red Hat Advanced Cluster Management navigation, select Infrastructure > Clusters.
- Click the name of your target cluster to view the details about the cluster.
- Select the Machine pools tab to view the machine pool information.
- From the machine pools page, select Disable autoscale from the Options menu for the target machine pool.
- Select the number of machine set replicas that you want. A machine set replica maps directly with a node on the cluster.
- Click Scale to submit the changes. It might take several minutes to display in the console.
- Click View machines in the notification on the Machine pools tab to view the status of the scaling.
To disable autoscaling by using the command line, complete the following steps:
Enter the following command to view your list of machine pools:
oc get machinepools -n <managed-cluster-namespace>
Replace
managed-cluster-namespace
with the namespace of your target managed cluster.Enter the following command to edit the YAML file for the machine pool:
oc edit machinepool <name-of-MachinePool-resource> -n <namespace-of-managed-cluster>
Replace
name-of-MachinePool-resource
with the name of yourMachinePool
resource.Replace
namespace-of-managed-cluster
with the name of the namespace of your managed cluster.-
Delete the
spec.autoscaling
field from the YAML file. -
Add the
spec.replicas
field to the resource YAML. -
Add the number of replicas to the
replicas
setting. - Save the file to submit the changes.
Autoscaling is disabled.
4.1.2. Manually scaling your cluster
If you do not want to enable autoscaling of your cluster, you can use the Red Hat Advanced Cluster Management console or the command line to change the static number of replicas that you want your cluster to maintain. This can help to increase or decrease the size, as needed.
4.1.2.1. Manually scaling clusters by using the console
To scale your MachinePool
resources using the Red Hat Advanced Cluster Management console, complete the following steps:
- In the Red Hat Advanced Cluster Management navigation, select Infrastructure > Clusters.
- Click the name of your target cluster to view the details about the cluster.
Select the Machine pools tab to view the machine pool information.
Note: If the value in the Autoscale field is
Enabled
you must first disable the autoscaling feature by completing the steps in Disabling autoscaling before continuing.- From the Options menu for the machine pool, select Scale machine pool.
- Adjust the number of machine set replicas to scale the machine pool.
- Select Scale to implement the change.
4.1.2.2. Manually scaling clusters by using the command line
To scale your MachinePool
resources using the command line, complete the following steps:
Enter the following command to view your list of machine pools:
oc get machinepools -n <managed-cluster-namespace>
Replace
managed-cluster-namespace
with the namespace of your target managed cluster.Enter the following command to edit the YAML file for the machine pool:
oc edit machinepool <name-of-MachinePool-resource> -n <namespace-of-managed-cluster>
Replace
name-of-MachinePool-resource
with the name of yourMachinePool
resource.Replace
namespace-of-managed-cluster
with the name of the namespace of your managed cluster.-
Update the
spec.replicas
configuration in the YAML to the number of replicas. - Save the file to submit the changes.
Your cluster is using the new size settings.
4.2. Scaling imported managed clusters
Imported managed clusters do not have the same resources as clusters that were created by Red Hat Advanced Cluster Management. For that reason, the procedures for scaling the clusters is different. The documentation for the provider contains information about how to scale the clusters for imported clusters.
See the following list of recommended settings for each available provider, but also see the documentation for more specific information:
4.2.1. OpenShift Container Platform clusters
See Recommended cluster scaling practices and Manually scaling a MachineSet in the OpenShift Container Platform documentation that applies to the version that you are using.
4.2.2. Amazon Elastic Kubernetes Services
If you are changing the number of nodes of an Amazon EKS cluster that you imported, see Cluster autoscaler for information about scaling the cluster.
4.2.3. Google Kubernetes Engine
If you are changing the number of nodes of a Google Kubernetes Engine cluster that you imported, see Resizing a cluster for information about scaling the cluster.
4.2.4. Microsoft Azure Kubernetes Service
If you are changing the number of nodes of an Azure Kubernetes Services cluster that you imported, see Scaling a cluster for information about scaling the cluster.
4.2.5. VMware vSphere
If you are changing the number of nodes of a VMware vSphere cluster that you imported, see Edit cluster settings for information about scaling the cluster.
4.2.6. Red Hat OpenStack Platform
If you are changing the number of nodes of a Red Hat OpenStack Platform cluster that you imported, see Auto scaling for instances for information about scaling the cluster.
4.2.7. Bare metal cluster
If you are changing the number of nodes of a bare metal cluster that you imported, see Expanding the cluster for information about scaling the cluster.
Note: Bare metal clusters are only supported when the hub cluster is OpenShift Container Platform version 4.6, and later.
4.2.8. IBM Kubernetes Service
If you are changing the number of nodes of an IBM Kubernetes Service cluster that you imported, see Adding worker nodes and zones to clusters for information about scaling the cluster.