在kubernetes中设置限制/请求的最佳策略是什么? [英] What is the best strategy to setup limits/requests in the kubernetes?

查看:54
本文介绍了在kubernetes中设置限制/请求的最佳策略是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在设置Web django服务器/python处理器/celery worker的限制/请求方面,我们遇到了很大的问题.我们目前的策略是查看最近7天的图表使用情况:

We have big problems with setting limits/requests in our web django servers/python processors/celery workers. Our current strategy is to look at the usage of the graphs in the last 7 days:

1)获得原始平均值(不包括峰值)

1) get raw average excluding peak

2)添加30%的缓冲区

2) add 30% buffer

3)设置限制2个时间请求

3) set limits 2 time requests

它或多或少地起作用,但是随后服务的代码被更改并且之前设置的限制不再有效.其他策略是什么?

It works more or less, but then service's code is changed and limits which were set before are not valid anymore. What are the other strategies?

您将如何为这些图表设置限制/要求:

How would you set up limits/requests for those graphs:

1)处理器:

2)芹菜节拍

3)Django(工件可能以某种方式与部署相关)

3) Django (artifacts probably connected somehow to rollouts)

推荐答案

我建议您从应用程序占用的平均CPU和内存值开始,然后启用自动缩放. Kunernetes具有多种自动缩放功能.

I would suggest you to start with the average CPU and memory value that the application takes and then enable auto scaling. Kunernetes has multiple kinds of autoscaling.

  • 水平吊舱自动缩放器
  • 垂直吊舱自动缩放器

水平吊舱自动缩放 .如果Pod的CPU或内存超过设置为阈值的CPU或内存的百分比或容量,HPA将自动创建新的Pod.

Horizontal pod autoscaling is commonly used these days. HPA will automatically create new pods if the pods CPU or memory exceeds the percentage or volume of CPU or memory set as threshold.

在部署之前监视新版本,并查看为什么确切地说新版本需要更多的内存.排除故障并且尝试减少资源消耗限制.如果不是这样,请使用新的CPU和内存值更新资源请求.

Monitor the new releases before deployment and see why exactly the new release needs more memory. Troubleshoot and try to reduce the resource consumption limit. If that is not update the resource request with new CPU and memory value.

这篇关于在kubernetes中设置限制/请求的最佳策略是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆