pod的自动扩容/缩容

参考

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: nginxtest    #应用名
  namespace: default #集群空间
spec:
  scaleTargetRef:
    apiVersion: extensions/v1beta1
    kind: Deployment //需要伸缩的资源类型
    name: nginxtest  //需要伸缩的资源名称
  maxReplicas: 5 //资源最大副本数
  minReplicas: 1 //资源最小副本数
  targetCPUUtilizationPercentage: 50 //触发伸缩的cpu使用率
apiVersion: "autoscaling/v2beta1"
kind: "HorizontalPodAutoscaler"
metadata:
  name: "firststrick"
spec:
  maxReplicas: 5
  minReplicas: 1
  scaleTargetRef:
    apiVersion: "apps/v1beta1"
    kind: "Deployment"
    name: "firststrick"
  metrics:
  - resource:
      targetAverageUtilization: 50
      name: "memory"
    type: "Resource"
posted @ 2020-08-07 11:00  博客萨斯州  阅读(270)  评论(0编辑  收藏  举报