简体   繁体   English

Kubernetes 中 QoS Burstable pod 的资源分配

[英]Resource allocation for QoS Burstable pods in Kubernetes

If limit resources are greater than request resources, K8 will assign pod to QoS Burstable如果limit资源大于request资源,K8 会将 pod 分配给QoS Burstable

Sample configuration:示例配置:

apiVersion: v1
kind: Pod
metadata:
  name: test-metadata
  namespace: demo
spec:
  containers:
  - name: test1
    image: nginx
    resources:
      limits:
        memory: "14Gi"
      requests:
        memory: "4Gi"
  • Will Kubernetes always assign this pod on an instance that will have 14GB memory? Kubernetes 是否总是将这个 pod 分配到一个具有 14GB 内存的实例上?
  • Will Kubernetes always reserve 14 GB memory for this pod? Kubernetes 会一直为这个 pod 预留 14 GB 的内存吗? If yes, then how is it different than QoS Guaranteed class?如果是,那么它与QoS Guaranteed类有何不同?

I don't want to use QoS Guaranteed as the workload can vary.我不想使用QoS Guaranteed因为工作负载可能会有所不同。

By default Kubernetes takes only resource requests into account when trying to schedule the pods.默认情况下,Kubernetes 在尝试调度 Pod 时仅考虑资源请求。 This means that your pod will only be scheduled to some node which has at least so much resources available as requested by the pod.这意味着您的 Pod 只会被调度到某个节点,该节点至少具有 Pod 请求的可用资源。

To be even more precise the pod is going to be scheduled to one of the nodes such that sum of the resources requested by all the pods ( including the pod it is trying to schedule ) does not exceed the nodes allocatable resources.更准确地说,pod 将被调度到节点之一,这样所有 pod(包括它试图调度的 pod)请求的资源总和不会超过节点可分配的资源。 Here the operative words are allocatable resources .这里的操作词是可分配资源

Allocatable resources are those resources, which are available in excess of resources necesarry to operate system pods.可分配资源是指那些超出操作系统 Pod 所需资源的可用资源。 How much of the hardware resources are reserved for system processes is configurable property of Kubernetes and is better described in their documentation of node allocatable resources为系统进程保留了多少硬件资源是 Kubernetes 的可配置属性,在他们的节点可分配资源文档中有更好的描述

Memory limits are not taken into consideration when scheduling pods.调度 Pod 时不考虑内存限制。

Will Kubernetes always assign this pod on an instance that will have 14GB memory? Kubernetes 是否总是将这个 pod 分配到一个具有 14GB 内存的实例上?

By default, this pod will be assigned to any node that meets the request for 4GB memory.默认情况下,这个 pod 将分配给任何满足 4GB 内存请求的节点。

On the node side, any pod that uses more than its requested resources is subject to eviction when the node runs out of resources.在节点方面,当节点耗尽资源时,任何使用超过其请求资源的 pod 都会被驱逐。 In other words, Kubernetes never provides any guarantees of availability of resources beyond a Pod's requests.换句话说,Kubernetes 从不提供任何超出 Pod 请求的资源可用性保证。

Using a memory limit that exceeds the node's total memory will never be reached.使用超过节点总内存的内存限制将永远不会达到。

Will Kubernetes always reserve 14 GB memory for this pod? Kubernetes 会一直为这个 pod 预留 14 GB 的内存吗? If yes, then how is it different than QoS Guaranteed class?如果是,那么它与 QoS 保证类有何不同?

No, by default kubernetes will reserve the least amount of memory needed which would be 4GB as request.不,默认情况下 kubernetes 将保留所需的最少内存量,即 4GB 作为请求。

Scheduler also takes into consideration scheduler configuration and scheduler policies :调度程序还考虑了调度程序配置调度程序策略

Scheduler configuration allows to customize the behavior of the kube-scheduler by writing a configuration file and passing its path as a command line argument.调度程序配置允许通过编写配置文件并将其路径作为命令行参数传递来自定义kube-scheduler的行为。

A scheduling Policy can be used to specify the predicates and priorities that the kube-scheduler runs to filter and score nodes , respectively.调度策略可用于指定kube-scheduler运行以分别过滤和评分节点谓词优先级

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM