The Kubernetes metrics backend interfaces with the Kubernetes API to expose allocation metrics gathered by querying for pod resource requests.
Since the Kubernetes metrics backend implementation uses an in-cluster configuration, no additional configuration is required.
apiVersion: cerebral.containership.io/v1alpha1
kind: MetricsBackend
metadata:
name: kubernetes
spec:
type: kubernetes
- CPU Percent Allocation
- GPU Percent Allocation
- Memory Percent Allocation
- Ephemeral Storage Percent Allocation
- Pod Percent Allocation
Returns the percent of allocated CPUs across the nodes in the autoscaling group by summing the total CPU requests of the pods, and dividing by the nodes' total allocatable CPUs.
cpu_percent_allocation
No configuration is available for this metric type.
apiVersion: cerebral.containership.io/v1alpha1
kind: AutoscalingPolicy
metadata:
name: cpu-example-policy
spec:
metric: cpu_percent_allocation
metricConfiguration: {}
metricsBackend: kubernetes
pollInterval: 15
samplePeriod: 300
scalingPolicy:
scaleDown:
adjustmentType: absolute
adjustmentValue: 1
comparisonOperator: <=
threshold: 30
scaleUp:
adjustmentType: absolute
adjustmentValue: 2
comparisonOperator: '>='
threshold: 70
Returns the percent of allocated GPUs across the nodes in the autoscaling group by summing the total GPU requests of the pods, and dividing by the nodes' total allocatable GPUs.
Note: Both
amd.com/gpu
andnvidia.com/gpu
are summed together when calculating requested and allocatable GPU totals
gpu_percent_allocation
No configuration is available for this metric type.
apiVersion: cerebral.containership.io/v1alpha1
kind: AutoscalingPolicy
metadata:
name: gpu-example-policy
spec:
metric: gpu_percent_allocation
metricConfiguration: {}
metricsBackend: kubernetes
pollInterval: 15
samplePeriod: 300
scalingPolicy:
scaleDown:
adjustmentType: absolute
adjustmentValue: 1
comparisonOperator: <=
threshold: 30
scaleUp:
adjustmentType: absolute
adjustmentValue: 2
comparisonOperator: '>='
threshold: 70
Returns the percent of allocated memory across the nodes in the autoscaling group by summing the total memory requests of the pods, and dividing by the nodes' total allocatable memory.
memory_percent_allocation
No configuration is available for this metric type.
apiVersion: cerebral.containership.io/v1alpha1
kind: AutoscalingPolicy
metadata:
name: memory-example-policy
spec:
metric: memory_percent_allocation
metricConfiguration: {}
metricsBackend: kubernetes
pollInterval: 15
samplePeriod: 300
scalingPolicy:
scaleDown:
adjustmentType: absolute
adjustmentValue: 1
comparisonOperator: <=
threshold: 30
scaleUp:
adjustmentType: absolute
adjustmentValue: 2
comparisonOperator: '>='
threshold: 70
Returns the percent of allocated ephemeral storage across the nodes in the autoscaling group by summing the total ephemeral storage requests of the pods, and dividing by the nodes' total allocatable ephemeral storage.
ephemeral_storage_percent_allocation
No configuration is available for this metric type.
apiVersion: cerebral.containership.io/v1alpha1
kind: AutoscalingPolicy
metadata:
name: ephemeral-storage-example-policy
spec:
metric: ephemeral_storage_percent_allocation
metricConfiguration: {}
metricsBackend: kubernetes
pollInterval: 15
samplePeriod: 300
scalingPolicy:
scaleDown:
adjustmentType: absolute
adjustmentValue: 1
comparisonOperator: <=
threshold: 30
scaleUp:
adjustmentType: absolute
adjustmentValue: 2
comparisonOperator: '>='
threshold: 70
Returns the percent of allocated pods across the nodes in the autoscaling group by summing the total number of pods running on the nodes, and dividing by the nodes' total allocatable pods.
pod_percent_allocation
No configuration is available for this metric type.
apiVersion: cerebral.containership.io/v1alpha1
kind: AutoscalingPolicy
metadata:
name: pod-example-policy
spec:
metric: pod_percent_allocation
metricConfiguration: {}
metricsBackend: kubernetes
pollInterval: 15
samplePeriod: 300
scalingPolicy:
scaleDown:
adjustmentType: absolute
adjustmentValue: 1
comparisonOperator: <=
threshold: 30
scaleUp:
adjustmentType: absolute
adjustmentValue: 2
comparisonOperator: '>='
threshold: 70