其他分享
首页 > 其他分享> > hpa 动态扩展

hpa 动态扩展

作者:互联网

方式
https://kubernetes.io/zh/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/
kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10
kubectl autoscale deployment nginx-deployment --cpu-percent=50 --min=1 --max=10 --dry-run=client -oyaml
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  creationTimestamp: null
  name: php-apache
spec:
  maxReplicas: 10
  minReplicas: 1
  scaleTargetRef:  ### 将要扩展的目标引用
    apiVersion: apps/v1
    kind: Deployment
    name: php-apache  ## Pod limit: 100m  
  targetCPUUtilizationPercentage: 50  ### cpu使用超过50%就扩容,低于就缩容

### 计算方式  100m   100m   100m   100m  100m  
#  kubectl run -i --tty load-generator --rm --image=busybox --restart=Never -- /bin/sh -c "while sleep 0.01; do wget -q -O- http://php-apache; done"

标签:kubectl,100m,php,autoscale,--,扩展,apache,hpa,动态
来源: https://www.cnblogs.com/z-sir/p/16323622.html