Creating horizontal pod autoscaler

The Sterling Configure, Price, Quote Helm chart in OpenShift® Container Platform supports horizontal pod autoscaling based on the observed CPU utilization that can be achieved by creating a Horizontal Pod Autoscaler (HPA) policy for a deployment.

Procedure

  1. Deploy the IBM certified containers.
  2. Search for the deployments by running the following command:
    oc get deploy -n <namespace>

    Alternatively, you can use the Helm Command Line Tool and run the following command to retrieve the list of deployments.
    helm list

    All the deployments that are running in the current namespace are listed.

  3. Create an HPA policy for a deployment.

Example

To create an HPA policy for the application server deployment, run the following command:
oc autoscale deployment <deployment name> --min=1 --max=2 --cpu-percent=80 -n <namespace>

Here, <deployment name> refers to the name of the deployment and <namespace> refers to the namespace in which the deployment is running.

Results: An HPA policy with the same name as the deployment name is created with minimum replicas as 1, maximum replicas as 2, and a target CPU utilization threshold as 80%. Based on the CPU utilization by the deployment, the number of replicas are automatically scaled up or scaled down.

For more information about Pod Autoscaling, see Red Hat OpenShift documentation.

Note: If you want to delete an HPA policy, run the following command:
oc delete hpa <hpa name> -n <namespace>
Here, <hpa name> refers to the HPA policy name and <namespace> refers to the namespace in which the HPA is created.