Resizing a deployment

Whenever a Kubernetes deployment is overallocated in terms of the CPU bandwidth, an event is raised in the event monitoring solution such as BMC Helix AIOps or BMC Helix Operations Management. By using BMC Helix Intelligent Automation, an automation engineer can create a policy to resize the CPU size. 

After updating the CPU size, the Kubernetes deployment gets restarted automatically.

Important

The process described in this topic is for one of the Kubernetes actions supported by BMC Helix Intelligent Automation. Use the steps in this topic to add any Kubernetes actions while creating a policy.

To add the Resize Deployment action to a policy

  1. In the BMC Helix Intelligent Automation console, click Policies and the click Create Automation Policy.
  2. In the Policy Information section, enter a unique name and an optional description for the policy. 
  3. Select Manual or Automatic depending upon whether you want to execute the policy manually or automatically based on the incoming events.
  4. In the Trigger section, click Browse and perform one of the following steps to select an event:
    1. From the Select Event Type tab, select an existing event type, and click Done.
    2. On the Paste Event JSON tab, enter event in the JSON format, and click Done.

      {
          "tags": {
              "event_type": "OVERALLOCATED_CONTAINER_RECOMMENDATION",
              "platform": "kubernetes"
          },
          "payload": {
              "generated_by": {
                  "product": "AIOps",
                  "version": "21.05.00"
              },
              "resources": [
                  {
                      "resource_id": "?",
                      "resource_name": "automation",
                      "account_id": "?",
                      "account_name": "?",
                      "cluster": "rem-qa",
                      "namespace": "ryan",
                      "deployment": "schedulerplugin",
                      "current_cpu_request": 500,
                      "current_cpu_limit": 1000,
                      "current_memory_request": 2560,
                      "current_memory_limit": 2560,
                      "cpu_demand": 25,
                      "cpu_demand_peak": 350,
                      "memory_demand": 2227,
                      "memory_demand_peak": 2227,
                      "tags": {
                          "Environment": [
                              "Trial"
                          ],
                          "Department": [
                              "Sales"
                          ]
                      },
                      "container_cpu_recommendation": {
                          "action": "reduce_cpu_allocation",
                          "recommended_cpu_request": "200m",
                          "reclaimable_cpu": 450,
                          "recommended_cpu_limit": "500m"
                      }
                  }
              ]
          }
      }
  5. In the Trigger Condition text box, use the expression builder to build the following conditional expression to match the trigger condition to the event:

    ( tags.event_type == OVERALLOCATED_CONTAINER_RECOMMENDATION ) && ( tags.platform == kubernetes ) && (tags.event.payload.resources[0].container_cpu_recommendation.action == reduce_cpu_allocation)
  6. To add system or custom tags to the policy, perform the following steps:
    1. System tags: Select one or more tags from the list of available system tags. 
      Based on the event, some system tags are displayed.
    2. Custom tags: In the Tags (Optional) section, enter a key-value pair. 
      Tag key should start with an alphabet and end with an alphanumeric character. Key supports alphanumeric characters and periods, dashes, and underscores. 
  7. To add action to the policy, click Add Action and perform the following steps by using the action wizard:
    1. From the Pick an automation tool section, click the connector name.
      Only configured connectors are displayed here. The wizard takes you to the next step to select an action. 
    2. Click Select against the Resize Deployment action.
      The wizard takes you to the next step to configure an action.
    3. Provide the following information:
      1. Enter the name of the Kubernetes deployment that you want to update. 

      2. Enter the name of the Kubernetes namespace in which the deployment is available.
      3. In Request Body > Spec > Template > Spec > Containers > Item 1, either enter the values, or use the event parameters from the right pane to populate these values:

        FieldDescription
        NameName of the container for which you want to allocate the CPU resources
        Resources > Limits > CpuRecommended CPU limit
        Requests > CpuRecommended CPU request

        Note

        Based on the selected event, the event slots with the values specified in the event appear under the Parameters section on the UI. You can click any of the parameters and its value gets copied. You can paste it while defining the action in the policy. 

    4. Click Done.
      The added action appears in the Action Configuration section on the Create Automation Policies page.
  8. In the Estimated Savings section, enter an approximate time (in minutes) and money (in USD) that you may save by automating this action.
  9. Select Publish Policy and click Save to publish the policy.

Was this page helpful? Yes No Submitting... Thank you

Comments