Skip to main content
Version: 2.13.0

Event Agent

Installing the Smart Scaler Agent installs the Event Agent and the Inference Agent. This topic describes the Event Agent, which dynamically scales pods for a scheduled event.

Overview

The Event Agent (EA) is a component of the Smart Scaler platform that helps to dynamically scale the application up when the event starts and scale it down when the event ends. By default, the Event Agent scales the application pods by directly modifying the In-Cluster HPA minimum pod counts for the applications it is configured to manage. By adjusting the minimum pod count, the event scaler will immediately ensure that at least the minimum number of pods are available to meet the demand of a scheduled event. EA also supports scaling application pods using the GitOps approach for these pre-defined events. In that model, EA modifies the Git configuration and raise a PR, enabling your GitOps framework to detect and apply the change. We recommend using the direct In-Cluster approach for its simplicity when applying changes. However, if the HPAs are deployed through GitOps use the GitOps approach.

Benefits

The Event Agent:

  • Auto detects configurations related to an application
  • Automates the process of adjusting the number of pods during an event
  • Is GitOps friendly, and supports cool-down to manage post-event traffic loss
  • Resets to the original minimum and maximum pods after the event concludes
  • Provides easy traceability and auditing

Event Agent Component

The Event Agent consists of the Agent Controller. This component contains the application configuration that auto-detects HPAs. It gets updated whenever the application changes. Its user-defined objects schedule events, which are responsible for autoscaling pods. It also contains the application's microservices relationship management. You can override its configuration.

How Event Agent Scales the Application Pods

The application pods for an event can be scaled through the In-Cluster or GitOps approach. First, the user defines the application by specifying the pod deployments that make it up. The Event Agent will scale all the pods that make up an application together (and with the relative proportion to each other observed by Smart Scaler).
Then events are defined based on expected load during specific time frames in the future. For example, Next Tuesday, I will need 5x my normal capacity from 6 pm to 11 pm.

In-Cluster Approach For Scaling Application Pods

At the time of the event, the Event Agent dynamically scales the application pods at the time when the event starts using the In-Cluster approach.

The following diagram illustrates an In-Cluster event scaling configuration:

alt

The following sequential steps occur during the event scaling:

  1. The user creates an event through the UI or YAML and specifies the date/time in the future when that event should trigger.
  2. When the event starts, the Event Agent modifies the HPA minimum pod counts of each pod that makes up the application in proportion to the requested event capacity.
  3. When the event ends, the Event Agent scales down HPAs the same way.

GitOps Approach For Scaling Application Pods

The Event Agent is compatible with GitOps and works exceptionally well with Argo CD, a continuous delivery tool. In this configuration, EA will update the configuration in a Git repository and raise a PR (which may be configured for auto-approval to remove the need for manual approval). Argo CD will then automatically synchronize and deploy the HPA scaling changes to scale your application. During the event, this agent automatically scales up pods. After the event ends to avoid traffic loss this agent gradually cools down. Thus, this agent helps in reducing costs and prevents traffic loss.

Git Operations Service

The EA's Git Operations service component is its conduit to Git repos. If you are using the GitOps approach you will see this pod running to support the Git interactions.

The following diagram illustrates how the Event Agent components interact with the GitHub repository, Argo CD, and an application.

alt

The following sequential steps occur during the event autoscaling:

  1. The user defines the application or provides a reference to the Argo CD application manifest.
  2. The Event Agent automatically identifies the scaling configuration and checks the GitHub repository access.
  3. The user creates an event through YAML configuration or UI for a future time, defining the scaling factors.
  4. An hour before the event, a PR is created with the scaling changes.
  5. The PR is merged 5 minutes before the event and Argo CD handles the application to be scaled.
  6. After the event concludes, a PR is created to reset minimum values.
  7. A cool-down period starts after the PR to reset minimum values is merged.
  8. After the cool-down is over, which is about an hour, a PR is created to reset maximum values (if possible). The Agent Controller observes any configuration drifts and alerts the user by raising Kubernetes events.