Horizontal Pod Autoscaler:HPA的确切值是多少



我有以下清单:

应用程序:

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: "128Mi"
cpu: "100m"
limits:
memory: "500Mi"
cpu: "200m"          
---
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

及其HPA:

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

注意,在HPA中,目标CPU设置为20%

我的问题是:HPA占20%?它是requests.cpu(即:100米(吗?或limits.cpu(即:200米(?还是别的什么?

谢谢!

它基于resources.requests.cpu

对于每个pod的资源度量(如CPU(,控制器从资源度量API中获取HorizontalPodAutoscaler所针对的每个pod。然后,如果设置了目标利用率值,则控制器将利用率值计算为每个Pod中容器上等效资源请求的百分比

https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#how-水平足自动秤工作吗

相关内容

  • 没有找到相关文章

最新更新