Kuberenetes HPA showing <unkown>

10/9/2021

I want to use HPA on the frontend service, but I get <unknown> rather than a number Commands ran:

  1. kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml `
  2. kubectl get deployment metrics-server -n kube-system
     NAME             READY  UP-TO-DATE  AVAILABLE  AGE
     metrics-server   0/1    1           0          21s
  3. kubectl describe hpa <br> No resources found in default namespace
  4. kubectl autoscale deployment udagram-frontend --cpu-percent=50 --min=1 --max=10<br> horizontalpodautoscaler.autoscaling/udagram-frontend autoscaled
  5. kubectl describe hpa

enter image description here

deployment file

apiVersion: apps/v1
kind: Deployment
metadata:
  name: udagram-frontend
  labels:
    service: udagram-frontend
spec:
  replicas: 2
  selector:
    matchLabels:
      service: udagram-frontend
  template:
    metadata:
      labels:
        service: udagram-frontend
        api: external
    spec:
      containers:
        - name: udagram-frontend
          image: oussamabouchikhi/udagram-frontend:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 80
          resources:
            requests:
              memory: '64Mi'
              cpu: '250m'
            limits:
              memory: '1024Mi'
              cpu: '500m'
      restartPolicy: Always

Github repo: https://github.com/oussamabouchikhi/udagram-microservices

-- Oussama Bouchikhi
amazon-eks
amazon-web-services
hpa
kubernetes

0 Answers