K8s Lab 把当前仓库文档整理成一个可阅读的网页站点

Repository Reading Site

20-cpu-demo-hpa.yaml

manifests/12-hpa/20-cpu-demo-hpa.yaml

Text Assetmanifests/12-hpa/20-cpu-demo-hpa.yaml843 B2026年4月10日 05:42查看原始内容
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: cpu-demo
  namespace: autoscaling-lab
  labels:
    lesson: hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: cpu-demo
  minReplicas: 1
  maxReplicas: 4
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 50
  behavior:
    scaleUp:
      stabilizationWindowSeconds: 0
      selectPolicy: Max
      policies:
      - type: Pods
        value: 2
        periodSeconds: 15
      - type: Percent
        value: 100
        periodSeconds: 15
    scaleDown:
      stabilizationWindowSeconds: 30
      selectPolicy: Max
      policies:
      - type: Pods
        value: 4
        periodSeconds: 15
      - type: Percent
        value: 100
        periodSeconds: 15