2 minute read
Kubernetes’ users often set the replicas based on empirical values when creating application resources. Based on the replicas recommendation, you can analyze the actual application usage and recommend a more suitable replicas configuration. You can use it to improve the resource utilization of the cluster.
Based on the historical Workload CPU loads, find the workload’s lowest CPU usage per hour in the past seven days, and calculate the replicas with 50% (configurable) cpu usage that should be configured
pod-min-ready-seconds
| pod-available-ratio
Query the workload cpu usage in the past week.
replicas := int32(math.Ceil(workload_cpu_usage_medium_min / (rr.TargetUtilization * float64(requestTotal) / 1000.)))
Record recommended replicas to Metric: crane_analytics_replicas_recommendation
Support StatefulSet and Deployment by default,but all workloads that support Scale SubResource
are supported.
Configuration items | Default | Description |
---|---|---|
workload-min-replicas | 1 | Workload replicas than less than this value are not recommended |
pod-min-ready-seconds | 30 | Defines the min seconds to identify Pod is ready |
pod-available-ratio | 0.5 | Workload ready Pod ratio that less than this value are not recommended |
default-min-replicas | 1 | default minReplicas |
cpu-target-utilization | 0.5 | Calculate the minimum replicas based on this cpu utilization |