Bird
0
0

Which of the following is the correct YAML snippet to create a Vertical Pod Autoscaler targeting a deployment named my-app?

easy📝 Configuration Q12 of 15
Kubernetes - Resource Management
Which of the following is the correct YAML snippet to create a Vertical Pod Autoscaler targeting a deployment named my-app?
AapiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: my-app-hpa spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: my-app
BapiVersion: autoscaling.k8s.io/v1 kind: VerticalPodAutoscaler metadata: name: my-app-vpa spec: targetRef: apiVersion: apps/v1 kind: Deployment name: my-app
CapiVersion: v1 kind: Pod metadata: name: my-app-pod spec: containers: - name: my-app image: my-app-image
DapiVersion: autoscaling.k8s.io/v2 kind: VerticalPodAutoscaler metadata: name: my-app-vpa spec: target: apiVersion: apps/v1 kind: Deployment name: my-app
Step-by-Step Solution
Solution:
  1. Step 1: Check apiVersion and kind

    Correct VPA uses apiVersion: autoscaling.k8s.io/v1 and kind: VerticalPodAutoscaler.
  2. Step 2: Verify targetRef structure

    The targetRef field must specify the deployment with apiVersion, kind, and name correctly.
  3. Final Answer:

    YAML with apiVersion autoscaling.k8s.io/v1, kind VerticalPodAutoscaler, and targetRef for my-app deployment -> Option B
  4. Quick Check:

    VPA YAML uses targetRef, autoscaling.k8s.io/v1 [OK]
Quick Trick: VPA uses targetRef, not scaleTargetRef [OK]
Common Mistakes:
  • Using HorizontalPodAutoscaler instead of VerticalPodAutoscaler
  • Wrong apiVersion like autoscaling/v1
  • Incorrect field name target instead of targetRef

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes