Welcome to the Linux Foundation Forum!

Lab 8.2. Horizontal Pod Autoscaler (HPA)

alvarocana85
alvarocana85 Posts: 2
edited February 1 in LFS258 Class Forum

Hi!
In question 3 of lab 8.2, I'm supposed to run the following YAML, but I'm getting the following error and the pods aren't deploying.
Any ideas?

hpa-deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: hpa-app
spec:
replicas: 2
selector:
matchLabels:
app: hpa-app
template:
metadata:
labels:
app: hpa-app
spec:
containers:
- name: web
image: registry.k8s.io/hpa-example
ports:
- containerPort: 80
resources:
requests:
cpu: 5m
limits:

cpu: 10m

apiVersion: v1
kind: Service
metadata:
name: hpa-app
spec:
type: ClusterIP
selector:
app: hpa-app
ports:
- port: 80
targetPort: 80

k get po
NAME READY STATUS RESTARTS AGE
hpa-app-689bbdc665-5zlvx 0/1 Error 1 (3s ago) 7s
hpa-app-689bbdc665-vwswl 0/1 Error 1 (4s ago) 7s

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 44s default-scheduler Successfully assigned default/hpa-app-689bbdc665-5zlvx to ubuntu24worker
Normal Pulled 41s kubelet spec.containers{web}: Successfully pulled image "registry.k8s.io/hpa-example" in 406ms (819ms including waiting). Image size: 164030864 bytes.
Normal Pulled 39s kubelet spec.containers{web}: Successfully pulled image "registry.k8s.io/hpa-example" in 430ms (853ms including waiting). Image size: 164030864 bytes.
Normal Pulled 27s kubelet spec.containers{web}: Successfully pulled image "registry.k8s.io/hpa-example" in 456ms (456ms including waiting). Image size: 164030864 bytes.
Normal Pulling 2s (x4 over 42s) kubelet spec.containers{web}: Pulling image "registry.k8s.io/hpa-example"
Normal Created 2s (x4 over 41s) kubelet spec.containers{web}: Container created
Normal Pulled 2s kubelet spec.containers{web}: Successfully pulled image "registry.k8s.io/hpa-example" in 424ms (424ms including waiting). Image size: 164030864 bytes.
Normal Started 1s (x4 over 40s) kubelet spec.containers{web}: Container started
Warning BackOff 1s (x4 over 38s) kubelet spec.containers{web}: Back-off restarting failed container web in pod hpa-app-689bbdc665-5zlvx_default(c9e69060-db88-45f5-8d3c-5b80d74c3fcb)

Thanks!

Answers

  • Any advice?

  • chrispokorni
    chrispokorni Posts: 2,579
    edited February 10

    Hi @alvarocana85,

    I attempted to reproduce the issue, but unfortunately my every attempt yields a working deployment, no errors.

    What type of infrastructure is hosting your Kubernetes cluster (cloud - which provider, local - which hypervisor)?
    What are the sizes of the 2 VMs, what guest OS is running them?

    What are the outputs of:

    kubectl get nodes -o wide
    kubectl get pods -o wide -A
    kubectl top nodes
    kubectl top nodes --show-capacity
    kubectl top pods -A --containers --sum
    

    I also recommend using the code-block formatting option for better readability - from the top action ribbon. It was missing from your OP and it is impossible to tell if the manifest has any indentation issues that may impact the launching of the hpa-app deployment.

    Regards,
    -Chris

Categories

Upcoming Training