Complete the code to specify the metric type for CPU utilization in a Horizontal Pod Autoscaler YAML.
metrics:
- type: [1]The metric type for CPU utilization in a Horizontal Pod Autoscaler is Resource.
Complete the code to set the target average CPU utilization percentage in the Horizontal Pod Autoscaler spec.
spec:
targetCPUUtilizationPercentage: [1]The typical target average CPU utilization percentage is set to 80 to balance performance and resource usage.
Fix the error in the YAML snippet by completing the missing field for specifying the resource name in the metric.
metrics:
- type: Resource
resource:
name: [1]The resource name for CPU utilization must be cpu in the metric specification.
Fill both blanks to complete the YAML snippet for setting minimum and maximum replicas in Horizontal Pod Autoscaler.
spec: minReplicas: [1] maxReplicas: [2]
Minimum replicas are often set to 2 to ensure availability, and maximum replicas to 10 to limit resource usage.
Fill all three blanks to complete the YAML snippet for a Horizontal Pod Autoscaler targeting a deployment named 'web-app' in the 'default' namespace.
apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: web-app-hpa namespace: [1] spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: [2] minReplicas: 1 maxReplicas: 5 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: [3]
The namespace is default, the deployment name is web-app, and the average CPU utilization target is commonly set to 75 percent.