Selected topic
Scaling
Prefer practical output? Use related tools below while reading.
Here's how Cluster Autoscaler works:
Suppose we have a Kubernetes cluster with 3 worker nodes, each with 2 CPUs. Our pod deployment requires resources to run a busy workload, which consumes a significant portion of the available CPU capacity. In this scenario:
Example YAML configuration for Cluster Autoscaler:
yml
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: hpa-example
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-deployment
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50In this example, the HorizontalPodAutoscaler (HPA) configuration specifies a scale-up threshold of 50% and a maximum number of replicas to 10. When the average CPU utilization across all nodes exceeds 50%, CA will add more nodes until it reaches the maximum limit. Conversely, when the utilization drops below 30%, CA will start removing excess nodes.
Keep in mind: This is just an example configuration; you may need to adjust it based on your specific requirements and cluster architecture.