Containerized MID Server Autoscaling

  • Release version: Yokohama
  • Updated January 30, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Containerized MID Server Autoscaling

    Containerized MID Servers can be deployed on Kubernetes using StatefulSet with multiple replicas, enabling automatic scaling in response to workload demand. This autoscaling leverages Kubernetes Horizontal Pod Autoscaler (HPA) to dynamically adjust the number of MID Server pods based on CPU and memory metrics.

    Show full answer Show less

    Key Features

    • StatefulSet Deployment: MID Servers run as stateful applications with persistent volumes that store configuration and metadata files, ensuring state continuity across pod restarts.
    • Persistent Volume Claim (PVC): PVCs specify storage details such as storage class, access modes, and storage requirements. The PVC allows MID Servers to retain important files like config.xml and metadata even when pods are replaced.
    • Pod Replacement and State Preservation: When workload fluctuates, Kubernetes may terminate existing pods and create new ones. StatefulSet guarantees the same persistent volume is reattached to new pods so the MID Server can resume operation without loss of state.
    • Configuration Backup and Restore: Critical files including config.xml must be backed up on pod shutdown and restored on startup. An init script manages detection of deployment environment changes and adjusts configuration files accordingly before the MID Server starts.
    • Deployment via YAML Files: Deployment requests can be exported as YAML files to create or update StatefulSet workloads and MID Server pods. Reapplying updated YAML files recreates pods with restored configurations.
    • Horizontal Pod Autoscaler (HPA) Integration: HPA controllers can be created to enable autoscaling on existing StatefulSet workloads, supporting HPA versions 1 or 2. Applying the deployment YAML with HPA configuration activates autoscaling immediately.

    Practical Benefits for ServiceNow Customers

    • Automatic scaling of containerized MID Servers ensures efficient resource utilization and responsiveness to workload changes.
    • StatefulSet deployment maintains MID Server state and configuration integrity across pod lifecycle events, reducing downtime and manual interventions.
    • Support for persistent storage and configuration management simplifies MID Server maintenance in Kubernetes environments.
    • Flexible deployment via YAML files allows easy updates and version control of MID Server deployments.
    • HPA activation provides a straightforward way to enable autoscaling aligned with Kubernetes best practices.

    MID Servers can be deployed via StatefulSet with any number of replicas. They can scale automatically by leveraging Kubernetes Horizontal Pod Autoscaler (HPA). Horizontal Pod Autoscaler automatically updates a workload resource (such as a Deployment or StatefulSet) to match demand.

    Setup indicator for configuration phaseEnsure that the MID Server can connect to elements inside and outside your networkDownload and install the MID Server on a Linux or Windows hostConfigure your MID ServerConfigure MID Server securityEnsure that the MID Server can connect to elements inside and outside your networkDownload and install the MID Server on a Linux or Windows hostConfigure your MID ServerConfigure MID Server security
    Kubernetes can add or remove any numbers of stateful MID Server replicas as required by the workload. HPA only supports CPU and memory metrics. MID Servers can be deployed as a stateful application by providing the following information in the StatefulSet section of the deployment request form:
    • Name
    • Headless service name
    • Persistent volume claim (PVC)
    • Parameters, such as storage class, access modes, and storage request
    • The resource request/limit

    The PVC declares the desired persistent volume where the MID Server stores config.xml, meta data files, and several of its sub-folders.

    During workload fluctuations, a pod with a running MID Server container can be removed and replaced by a new one. StatefulSet ensures the same persistent volume is attached to the new pod, which allows the MID Server to resume its state.

    The only sub-folders that can be mounted to the persistent volume are those that are initially empty with a new MID Server installation. The config.xml file and other meta data files must be backed up when the pod is shut down and restored during start-up.

    Deployment requests exported as YAML files can be used to create a StatefulSet workload and new MID Server pods in the Kubernetes cluster.

    When you make changes to the deployment YAML file and re-apply it, the existing pods of the deployment are recreated. With StatefulSet deployment, the configuration files are restored from the backup folder. The init script must detect the deployment environment changes and apply them to the configuration files before MID server is started.

    HPA Autoscaling activation

    HPA Autoscaling can be activated for any existing StatefulSet workload by creating an HPA controller.

    When you create a deployment request, you can choose either HPA version 1 or version 2.

    When creating a deployment request on the instance with an HPA configuration, apply the exported YAML file and HPA autoscaling begins working immediately.