0
0
Kubernetesdevops~10 mins

Horizontal Pod Autoscaler in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to create a Horizontal Pod Autoscaler for deployment 'webapp' targeting CPU usage at 50%.

Kubernetes
kubectl autoscale deployment webapp --cpu-percent=[1] --min=1 --max=5
Drag options to blanks, or click blank then click option'
A50
B80
C30
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Using too high or too low CPU percent causing no scaling or too frequent scaling.
2fill in blank
medium

Complete the YAML snippet to specify the minimum number of replicas as 2 in the Horizontal Pod Autoscaler spec.

Kubernetes
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: example-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: example
  minReplicas: [1]
  maxReplicas: 10
  metrics:
  - type: Resource
Drag options to blanks, or click blank then click option'
A1
B2
C3
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting minReplicas to 0 which can cause downtime.
3fill in blank
hard

Fix the error in the metric type to correctly specify CPU resource metric in the HPA spec.

Kubernetes
metrics:
- type: [1]
  resource:
    name: cpu
    target:
      type: Utilization
      averageUtilization: 60
Drag options to blanks, or click blank then click option'
AExternal
BPods
CResource
DObject
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Pods' or 'External' which are invalid for CPU resource metrics.
4fill in blank
hard

Fill both blanks to complete the command that describes the Horizontal Pod Autoscaler named 'frontend-hpa' in namespace 'prod'.

Kubernetes
kubectl [1] hpa frontend-hpa -n [2]
Drag options to blanks, or click blank then click option'
Adescribe
Bprod
Cdelete
Dcreate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get' which shows summary, or wrong namespace.
5fill in blank
hard

Fill all three blanks to complete the YAML snippet for HPA targeting deployment 'api-server' with min 2, max 6 replicas, and CPU utilization target 70%.

Kubernetes
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: [1]
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: [2]
  minReplicas: [3]
  maxReplicas: 6
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
Drag options to blanks, or click blank then click option'
Aapi-server-hpa
Bapi-server
C2
Dfrontend
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing deployment and HPA names or wrong minReplicas value.