简体   繁体   English

minikube start - 如何修改传递给 kubeadm 的 KubeletConfiguration?

[英]minikube start - howto modify KubeletConfiguration passed to kubeadm?

I would like to set the value KubeletConfiguration.cpuCFSQuota = false in the config.yaml passed to kubeadm when launching minikube to turn off CPU resource checking, but I have not managed to find the options to do this through the documentation here https://minikube.sigs.k8s.io/docs/handbook/config/ .我想在启动minikube以关闭 CPU 资源检查时在传递给kubeadmconfig.yaml中设置值KubeletConfiguration.cpuCFSQuota = false ,但我没有设法通过此处的文档https://找到执行此操作的选项minikube.sigs.k8s.io/docs/handbook/config/ The closest solution I have found is to use the option --extra-config=kubelet.cpu-cfs-quota=false but the --cpu-cfs-quota option for the kubelet has been deprecated and no longer has an effect.我找到的最接近的解决方案是使用选项--extra-config=kubelet.cpu-cfs-quota=falsekubelet--cpu-cfs-quota选项已被弃用并且不再有效。

Any ideas appreciated.任何想法表示赞赏。

Environment:环境:

  • Ubuntu 20.04 Ubuntu 20.04
  • Minikube 1.17.1 Minikube 1.17.1
  • Kubernetes 1.20.2 Kubernetes 1.20.2
  • Driver docker (20.10.2)驱动程序 docker (20.10.2)

Thanks, Piers.谢谢,皮尔斯。

Using the --extra-config=kubelet.使用--extra-config=kubelet. flag alongside minikube start is a good approach but you would also need to Set Kubelet parameters via a config file .minikube start一起标记是一个好方法,但您还需要通过配置文件设置 Kubelet 参数

As you already noticed the --cpu-cfs-quota flag:正如您已经注意到--cpu-cfs-quota标志:

Enable CPU CFS quota enforcement for containers that specify CPU limits (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag.为指定 CPU 限制的容器启用 CPU CFS 配额强制(已弃用:应通过 Kubelet 的--config标志指定的配置文件设置此参数。

So you need to set that parameter by creating a kubelet config file:因此,您需要通过创建kubelet配置文件来设置该参数:

The configuration file must be a JSON or YAML representation of the parameters in this struct.配置文件必须是此结构中参数的 JSON 或 YAML 表示形式。 Make sure the Kubelet has read permissions on the file.确保 Kubelet 对该文件具有读取权限。

Here is an example of what this file might look like:以下是此文件的示例:

 apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration evictionHard: memory.available: "200Mi"

Now you can use that config file to set cpuCFSQuota = false :现在您可以使用该配置文件来设置cpuCFSQuota = false

// cpuCFSQuota enables CPU CFS quota enforcement for containers that
// specify CPU limits.
// Dynamic Kubelet Config (beta): If dynamically updating this field, consider that
// disabling it may reduce node stability.
// Default: true
// +optional`
CPUCFSQuota *bool `json:"cpuCFSQuota,omitempty"

and than call minikube with --extra-config=kubelet.config=/path/to/config.yaml然后用--extra-config=kubelet.config=/path/to/config.yaml

Alternately, you can start your minikube without the --extra-config flag and than start the Kubelet with the --config flag set to the path of the Kubelet's config file.或者,您可以在没有--extra-config标志的情况下启动您的 minikube,然后将--config标志设置为 Kubelet 配置文件的路径来启动 Kubelet。 The Kubelet will then load its config from this file.然后 Kubelet 将从该文件加载其配置。

I know these are a few steps more than you expected but setting the kubelet parameters via a config file is the recommended approach because it simplifies node deployment and configuration management.我知道这些步骤比您预期的要多,但是通过配置文件设置 kubelet 参数是推荐的方法,因为它简化了节点部署和配置管理。

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

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