Kubernetes 现在支持自动伸缩了吗?
Does Kubernetes support auto-scaling now?
Kubernetes 能否在监控负载增加或减少(即CPU 负载、流量)时自动增加或减少pods 的数量?
如果可以,我该如何配置?
pods 的自动缩放尚不可用,但它肯定在我们的路线图上,正如 Brendan 在 a previous answer 中提到的那样。
它实际上可以很容易地在 Kubernetes 的核心之外构建,使用 public Kubernetes API。不过,如果您宁愿等待其他人来构建它,看起来贡献者已经 started planning a design for one.
是的 Kubernetes 支持根据限制集自动扩展 pods,即 CPU 或内存
imagePullPolicy:始终
资源:
限制:
内存:“1Gi”
cpu:“256米”
要求:
内存:“64Mi”
cpu: "60m"
kubectl autoscale deployment nginx --cpu-percent=80 --min=5 --max=10
查看
kubectl 获取 hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
nginx Deployment/nginx 0% / 50% 5 10 5 1d
是的,新版本的 kubernetes 支持 auto-scaling.It 已作为水平 pod 添加到 K8 scaling.Find 更多信息
https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
为了使用自动缩放
kubectl autoscale deployment deployment_name --cpu-percent=10 --min=2 --max=5
--cpu-percent to denote the limit up to which scaling will not be performed .
--min denote minimum number of pods.
--max denote maximum number of pods.
运行
kubectl get hpa
观察结果。
TARGETS 列显示 current-cpu%/cpu-percent-mentioned-during-autoscale 对于这种情况,它是 10 。
随着负载的增加,Kubernetes 会自动创建新的 pods。
要检查这个去这个 link https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/
.
在 运行ning busybox 执行后
kubectl get pods
查看pods的编号。
Kubernetes 能否在监控负载增加或减少(即CPU 负载、流量)时自动增加或减少pods 的数量?
如果可以,我该如何配置?
pods 的自动缩放尚不可用,但它肯定在我们的路线图上,正如 Brendan 在 a previous answer 中提到的那样。
它实际上可以很容易地在 Kubernetes 的核心之外构建,使用 public Kubernetes API。不过,如果您宁愿等待其他人来构建它,看起来贡献者已经 started planning a design for one.
是的 Kubernetes 支持根据限制集自动扩展 pods,即 CPU 或内存 imagePullPolicy:始终 资源: 限制: 内存:“1Gi” cpu:“256米” 要求: 内存:“64Mi” cpu: "60m"
kubectl autoscale deployment nginx --cpu-percent=80 --min=5 --max=10 查看 kubectl 获取 hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE nginx Deployment/nginx 0% / 50% 5 10 5 1d
是的,新版本的 kubernetes 支持 auto-scaling.It 已作为水平 pod 添加到 K8 scaling.Find 更多信息 https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
为了使用自动缩放
kubectl autoscale deployment deployment_name --cpu-percent=10 --min=2 --max=5
--cpu-percent to denote the limit up to which scaling will not be performed .
--min denote minimum number of pods.
--max denote maximum number of pods.
运行
kubectl get hpa
观察结果。 TARGETS 列显示 current-cpu%/cpu-percent-mentioned-during-autoscale 对于这种情况,它是 10 。 随着负载的增加,Kubernetes 会自动创建新的 pods。 要检查这个去这个 link https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/ . 在 运行ning busybox 执行后
kubectl get pods
查看pods的编号。