You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
New to KubeDB? Please start here.
MSSQLServerAutoscaler
What is MSSQLServerAutoscaler
MSSQLServerAutoscaler is a Kubernetes Custom Resource Definitions (CRD). It provides a declarative configuration for autoscaling Microsoft SQL Server compute resources and storage of database in a Kubernetes native way.
MSSQLServerAutoscaler CRD Specifications
Like any official Kubernetes resource, a MSSQLServerAutoscaler has TypeMeta, ObjectMeta, Spec and Status sections.
Here is a sample MSSQLServerAutoscaler CRO for autoscaling is given below:
Sample MSSQLServerAutoscaler for mssqlserver database:
apiVersion: autoscaling.kubedb.com/v1alpha1
kind: MSSQLServerAutoscaler
metadata:
name: standalone-autoscaler
namespace: demo
spec:
databaseRef:
name: mssqlserver-standalone
opsRequestOptions:
apply: IfReady
timeout: 5m
compute:
mssqlserver:
trigger: "On"
podLifeTimeThreshold: 5m
minAllowed:
cpu: 800m
memory: 2Gi
maxAllowed:
cpu: 2
memory: 4Gi
controlledResources: ["cpu", "memory"]
containerControlledValues: "RequestsAndLimits"
resourceDiffPercentage: 10
storage:
mssqlserver:
expansionMode: "Online"
trigger: "On"
usageThreshold: 60
scalingThreshold: 50
Here, we are going to describe the various sections of a MSSQLServerAutoscaler CRD.
A MSSQLServerAutoscaler object has the following fields in the spec section.
spec.databaseRef
spec.databaseRef is a required field that point to the MSSQLServer object for which the autoscaling will be performed. This field consists of the following sub-field:
- spec.databaseRef.name : specifies the name of the MSSQLServer object.
spec.opsRequestOptions
These are the options to pass in the internally created opsRequest CRO. opsRequestOptions has two fields. They have been described in details here.
spec.compute
spec.compute specifies the autoscaling configuration for to compute resources i.e. cpu and memory of the database. This field consists of the following sub-field:
spec.compute.mssqlserverindicates the desired compute autoscaling configuration for a MSSQLServer database.
This has the following sub-fields:
triggerindicates if compute autoscaling is enabled for the database. If “On” then compute autoscaling is enabled. If “Off” then compute autoscaling is disabled.minAllowedspecifies the minimal amount of resources that will be recommended, default is no minimum.maxAllowedspecifies the maximum amount of resources that will be recommended, default is no maximum.controlledResourcesspecifies which type of compute resources (cpu and memory) are allowed for autoscaling. Allowed values are “cpu” and “memory”.containerControlledValuesspecifies which resource values should be controlled. Allowed values are “RequestsAndLimits” and “RequestsOnly”.resourceDiffPercentagespecifies the minimum resource difference between recommended value and the current value in percentage. If the difference percentage is greater than this value than autoscaling will be triggered.podLifeTimeThresholdspecifies the minimum pod lifetime of at least one of the pods before triggering autoscaling.
spec.storage
spec.storage specifies the autoscaling configuration for the storage resources of the database. This field consists of the following sub-field:
spec.storage.mssqlserverindicates the desired storage autoscaling configuration for a MSSQLServer database.
It has the following sub-fields:
triggerindicates if storage autoscaling is enabled for the database. If “On” then storage autoscaling is enabled. If “Off” then storage autoscaling is disabled.usageThresholdindicates usage percentage threshold, if the current storage usage exceeds then storage autoscaling will be triggered.scalingThresholdindicates the percentage of the current storage that will be scaled.expansionModeindicates the volume expansion mode.
Next Steps
- Learn about backup and restore SQL Server using KubeStash.
- Learn about MSSQLServer CRD here.
- Deploy your first MSSQLServer database with MSSQLServer by following the guide here.






























