更新时间:2022-03-11 GMT+08:00
分享

配置

  1. 注释外层kubelet.service的ExecStart。若不注释,会报错“存在多个ExeStart”。

    1
    vi /usr/lib/systemd/system/kubelet.service
    
    1
    #ExecStart=/usr/bin/kubelet
    

  2. 修改kubelet配置文件,启用拓扑管理策略。

    --topology-manager-policy可选:

    • single-numa-node
    • best-effort
    • restricted
    • none
    1
    vi /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Note: This dropin only works with kubeadm and kubelet v1.11+
    [Service]
    Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
    Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
    # This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
    EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
    # This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
    # the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
    EnvironmentFile=-/etc/sysconfig/kubelet
    
    1. 修改点一:添加如下两行
      1
      2
      ExecStartPre=/usr/bin/mkdir -p /sys/fs/cgroup/cpuset/system.slice/kubelet.service
      ExecStartPre=/usr/bin/mkdir -p /sys/fs/cgroup/hugetlb/system.slice/kubelet.service
      
    2. 修改点二:修改如下这行,添加CPU Manager和Topology Manager的配置开关
      1
      ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS --kube-reserved=cpu=2,memory=250Mi --cpu-manager-policy=static --feature-gates=CPUManager=true,TopologyManager=true --topology-manager-policy=single-numa-node
      

分享:

    相关文档

    相关产品

关闭导读