0

是否有已知的方法/关键字/主题来解决如何确定自动缩放阈值?

下面以 K8s HPA 为例,我只知道我可以安装一些监控工具,然后通过肉眼查看图表上显示的内存使用情况,以确定合适的阈值 100Mi。但是为什么不设置99Mi,为什么不设置101Mi呢?我觉得这个方法太手动了

  - type: Resource
    resource:
      name: memory
      target:
        type: AverageValue
        averageValue: 100Mi

由于我没有精通计算机科学,所以我想问

是否有解决此类问题的已知方法?

或者什么样的课程可以解决这个问题?

或者从学术文章中搜索的关键字是什么?

4

1 回答 1

0

In order to display this information without any graph you can use metrics server. Running it in your cluster makes it possible to get usage for nodes and individual pods through the kubectl top command.

Here`s an example where I'm checking the node resouces:

➜  ~ kubectl top node
NAME       CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
minikube   580m         28%    1391Mi          75%   

And for a pod:

➜  ~ kubectl top pod
NAME        CPU(cores)   MEMORY(bytes)   
front-end   0m           28Mi 

You can also see resource usages across individual containers instead of pods using the --containers option.

I assume that if you use HPA you have this already installed but it's worth to know that If you use minikube you can easily enable metrics server with minikube addons enable metrics-server. If you bootstrap your server using kubeadm then you have to install it and configure with all of it`s requirements in order to run correctly.

Lastly you can always check manually your pod usage with exec into it:

kubectl exec -it <name_of_the_pod>  top

You can here for more prod information about autoscalers.

于 2020-09-01T08:43:41.133 回答