<p>i have the fowllowing manifests:</p>
<p>The app:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hpa-demo-deployment
  labels:
    app: hpa-nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hpa-nginx
  template:
    metadata:
      labels:
        app: hpa-nginx
    spec:
      containers:
      - name: hpa-nginx
        image: stacksimplify/kubenginx:1.0.0
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: &quot;128Mi&quot;
            cpu: &quot;100m&quot;
          limits:
            memory: &quot;500Mi&quot;
            cpu: &quot;200m&quot;          
---
apiVersion: v1
kind: Service
metadata:
  name: hpa-demo-service-nginx
  labels:
    app: hpa-nginx
spec:
  type: LoadBalancer
  selector:
    app: hpa-nginx
  ports:
  - port: 80
    targetPort: 80
</code></pre>
<p>and its HPA:</p>
<pre><code>apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: hpa-demo-declarative
spec:
  maxReplicas: 10 # define max replica count
  minReplicas: 1  # define min replica count
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: hpa-demo-deployment
  targetCPUUtilizationPercentage: 20 # target CPU utilization
</code></pre>
<p>Notice in HPA, the target CPU is set to 20%</p>
<p>My question: which 20% the HPA takes ? is it requests.cpu (ie: 100m) ? or limits.cpu (ie: 200m) ? or something else ?</p>
<p>Thank you!</p>

Mohamed
<p>Its based off of the <code>resources.requests.cpu</code>.</p>
<blockquote>
<p>For per-pod resource metrics (like CPU), the controller fetches the metrics from the resource metrics API for each Pod targeted by the HorizontalPodAutoscaler. Then, if a target utilization value is set, the controller calculates the utilization value as a <strong>percentage of the equivalent resource request on the containers in each Pod</strong></p>
</blockquote>
<p><a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#how-does-a-horizontalpodautoscaler-work" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#how-does-a-horizontalpodautoscaler-work</a></p>
