docker - 如何设置Kubernetes Kubelet的限制?

标签 docker kubernetes containers pod kubelet

我正在使用具有1个主节点和2个具有4个核心cpu和256mb ram的worker的kubernetes集群。我想知道kubelet需要多少cpu和ram。

有什么方法可以设置kubelet的限制(cpu,内存)吗?我搜索了文档,但只发现了工作节点需求。

最佳答案

我认为您应该了解kubelet的作用。可以在kubelet documentation中找到。

The kubelet is the primary “node agent” that runs on each node. It can register the node with the apiserver using one of: the hostname; a flag to override the hostname; or specific logic for a cloud provider.

The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn’t manage containers which were not created by Kubernetes.

Other than from an PodSpec from the apiserver, there are three ways that a container manifest can be provided to the Kubelet.

File: Path passed as a flag on the command line. Files under this path will be monitored periodically for updates. The monitoring period is 20s by default and is configurable via a flag.

HTTP endpoint: HTTP endpoint passed as a parameter on the command line. This endpoint is checked every 20 seconds (also configurable with a flag).

HTTP server: The kubelet can also listen for HTTP and respond to a simple API (underspec’d currently) to submit a new manifest.



您可以在kubelet中使用多个标志,但是它们大多是已弃用,应通过Kubelet的--config标志指定的配置文件设置参数。这是在Set Kubelet parameters via a config file上解释的。

您可能感兴趣的标志是:
--application-metrics-count-limit int

Max number of application metrics to store (per container) (default 100) (DEPRECATED)


--cpu-cfs-quota

Enable CPU CFS quota enforcement for containers that specify CPU limits (default true) (DEPRECATED)


--event-qps int32

If > 0, limit event creations per second to this value. If 0, unlimited. (default 5) (DEPRECATED)


--event-storage-age-limit string

Max length of time for which to store events (per type). Value is a comma separated list of key values, where the keys are event types (e.g.: creation, oom) or "default" and the value is a duration. Default is applied to all non-specified event types (default "default=0") (DEPRECATED)


--event-storage-event-limit string

Max number of events to store (per type). Value is a comma separated list of key values, where the keys are event types (e.g.: creation, oom) or "default" and the value is an integer. Default is applied to all non-specified event types (default "default=0") (DEPRECATED)


--log-file-max-size uint

Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)


--pods-per-core int32

Number of Pods per core that can run on this Kubelet. The total number of Pods on this Kubelet cannot exceed max-pods, so max-pods will be used if this calculation results in a larger number of Pods allowed on the Kubelet. A value of 0 disables this limit. (DEPRECATED)


--registry-qps int32

If > 0, limit registry pull QPS to this value. If 0, unlimited. (default 5) (DEPRECATED)

关于docker - 如何设置Kubernetes Kubelet的限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58656768/

相关文章:

node.js - 小型 Node.js 应用程序 Pod 的 GKE CPU 不足

kubernetes - 为什么请求正文没有显示在Kubernetes API服务器审核日志中?

docker - docker 群或 Rancher 牛的 celery worker

angularjs - 将您的 Angular NodeJS 应用程序 Docker 化

docker - Docker撰写比特币服务

kubernetes - Kubeflow jupyter 笔记本已创建,但没有笔记本资源

css - 按钮不进入div?

CSS 容器/背景不显示;其余布局工程

c++ - 将原始数据包装在 std 容器中,如数组,具有运行时大小

docker - 在 Docker 镜像名称中,Alpine、Jessie、Stretch 和 Buster 有什么区别?