Kubernetes Autoscaling: HPA, VPA u0026 Cluster Autoscaler Quiz Quiz

Challenge your understanding of Kubernetes autoscaling with this focused quiz on Horizontal Pod Autoscaler (HPA), Vertical Pod Autoscaler (VPA), and Cluster Autoscaler concepts, best practices, and scenarios for optimized resource management in cloud-native environments.

  1. Basic HPA Functionality

    Which Kubernetes resource is responsible for automatically scaling the number of pod replicas based on observed CPU utilization, such as increasing deployment size during traffic spikes?

    1. Vertical Pod Autoscaler
    2. PodDisruptionBudget
    3. ReplicaSet
    4. Horizontal Pod Autoscaler

    Explanation: The Horizontal Pod Autoscaler automatically adjusts the number of pod replicas in response to metrics like CPU or memory utilization, making it ideal for handling fluctuating workloads. The Vertical Pod Autoscaler adjusts pod resource requests and limits but does not change replica counts. PodDisruptionBudget controls pod evictions, not scaling. ReplicaSet ensures a specified number of pod replicas but does not scale them automatically based on metrics.

  2. VPA Adjustment Scope

    When using Vertical Pod Autoscaler in Kubernetes, which aspect of a pod's configuration can VPA automatically modify to optimize resource utilization?

    1. Pod labels
    2. Service account tokens
    3. Persistent volume claims
    4. CPU and memory requests/limits

    Explanation: Vertical Pod Autoscaler is designed to automatically adjust the CPU and memory requests and limits for containers to match the application's real resource consumption. Service account tokens are managed by the control plane, and are not optimized by VPA. Pod labels are used for selection and organization, not for resource allocation. Persistent volume claims manage storage, not compute resources.

  3. Cluster Autoscaler Trigger

    In a scenario where pending pods cannot be scheduled due to insufficient node resources, which autoscaling mechanism is responsible for dynamically increasing the number of nodes in a Kubernetes cluster?

    1. Cluster Autoscaler
    2. Endpoint Controller
    3. Horizontal Pod Autoscaler
    4. Volume Expansion Controller

    Explanation: Cluster Autoscaler automatically adjusts the number of nodes in a cluster, adding nodes when pods cannot be scheduled due to lack of resources. The Endpoint Controller manages endpoints for services and is not related to scaling nodes. Horizontal Pod Autoscaler deals with adjusting pod replica counts, not cluster size. The Volume Expansion Controller manages storage resizing, unrelated to node scaling.

  4. HPA Metrics Support

    Which of the following metrics can be used by the Horizontal Pod Autoscaler to determine when to scale pods, assuming proper configuration?

    1. Network policies applied to namespaces
    2. Node selector annotations
    3. Pod affinity rules
    4. Custom application metrics reported via the metrics API

    Explanation: Horizontal Pod Autoscaler supports scaling based on standard resource metrics like CPU and memory and can use custom metrics exposed via the metrics API, such as request rates or application-specific signals. Pod affinity rules influence scheduling, not scaling. Node selector annotations help place pods on specific nodes but do not impact scaling decisions. Network policies manage connectivity and have no effect on autoscaling behavior.

  5. Autoscaler Compatibility

    If both HPA and VPA are enabled for the same deployment, what is the recommended approach to avoid unpredictable resource allocation behaviors?

    1. Disable cluster monitoring entirely
    2. Allow both to simultaneously modify requests and replica counts
    3. Run HPA on CPU or memory utilization and VPA in 'Off' or 'Recommendation' mode
    4. Permit only the ReplicaSet controller to manage scaling

    Explanation: Running HPA on resource utilization while setting VPA to 'Off' or 'Recommendation' mode prevents overlapping resource changes and avoids conflicts, as both would otherwise try to adjust requests independently. Allowing both to modify resources can lead to erratic scaling. Disabling monitoring is not recommended, as it removes visibility into system health. The ReplicaSet controller manages replica consistency, not dynamic resource scaling.