Set up the Autoscaler using Terraform configuration files
Home
·
Scaler component
·
Poller component
·
Forwarder component
·
Terraform configuration
·
Monitoring
Cloud Run functions
·
Google Kubernetes Engine
This directory contains Terraform configuration files to quickly set up the infrastructure of your Autoscaler.
The Autoscaler can currently be deployed as follows:
- Deployment to Cloud Run functions: Autoscaler components are deployed to Cloud Run functions, with Pub/Sub used for asynchronous messaging between components. Use this deployment type for serverless operation, and to take maximal advantage of Google Cloud managed services.
- Deployment to Google Kubernetes Engine (GKE): Autoscaler components are deployed to Google Kubernetes Engine (GKE), with Kubernetes-native constructs used for messaging and configuration. Use this deployment type if you want to use Kubernetes or cannot use the Google Cloud service dependencies in the Cloud Run functions model described above.
The monitoring module is an optional module for monitoring, and creates the following resources.
- Cloud Monitoring Dashboard: a starter dashboard users could deploy to get started. This dashboard has metrics that show the utilization and current state of a Memorystore Cluster instance that is being autoscaled.
The following steps are recommended for productionizing deployment of the Autoscaler:
- Begin by deploying the Autoscaler in Dev/Test environments and progress your use of the Autoscaler safely towards your Production environments.
- Incorporate the relevant portions of the supplied Terraform configuration into your own Terraform codebase. You may choose to use the supplied modules directly, or select portions of the modules to use in your own projects.
- Create additional cloud resource deployment pipelines using your CI/CD tooling to automate the deployment and lifecycle management of the Autoscaler. This should include the cloud resources that are used by the Autoscaler, as well as the Autoscaler application components themselves, i.e. the Cloud Run functions or container images for the Poller and Scaler components.
- Decouple the lifecycle of the Autoscaler components from the lifecycles of the Memorystore instances being scaled. In particular, it should be possible to completely tear down and redeploy all components of the Autoscaler without affecting your Memorystore instances.
- Store your Autoscaler configuration files in your source control system, along with the Terraform and application codebase.
- Automate updating the Autoscaler configuration using a deployment pipeline separate from deploying the Autoscaler itself. This will allow you to incorporate policy and other checks according to your organizational requirements (e.g. change freeze periods), as well as decoupling updates to the Autoscaler configuration from updates to the Autoscaler itself.
- Pay particular attention to the management and permissions of the service accounts you configure the Autoscaler to use. We recommend assigning minimally permissioned service accounts.
- Define alerts to be notified of autoscaling events that may affect your platform or your application. You can use log-based-alerts to configure alerts that will notify you whenever a specific message appears in the logs.
- In the case of the Centralized or Distributed deployment topologies, consider running the Autoscaler components in a dedicated project with tightly controlled access.
- In the case of deployment to gke, you may choose to incorporate addtional security measures, such as Artifact Analysis, Binary Authorization, and Container Threat Detection, to help secure your deployment.