kubernetes限制节点可的 pod 数量

55038137449

kubernetes 默认每个节点只能启动110个pod,可以在kubelet 中增加启动参数:

--max-pods=60

重启 kubelet 后生效。重启kubelet不会造成已有重启。

现在的kubernetes集群一般是基于 kubeadm 安装的kubernetes,kubelet 启动文件位置为:

/etc/systemd/system/kubelet.service.d/10-kubeadm.conf

原文大致如下:

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

Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true"
Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
... ...

ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS $KUBELET_INFRA_IMAGE $KUBELET_RES_LIMIT_ARGS $KUBELET_ROTATE $KUBELET_DOCKER_ROOT $KUBELET_NODE_STATUS_ARGS 

添加如下配置:

Environment="KUBELET_NODE_MAX_PODS=--max-pods=6000"

并在最后的 ExecStart 一行 添加启动参数 $KUBELET_NODE_STATUS_ARGS ,重启kubelet即可

systemctl daemon-reload
systemctl restart kubelet.service

Ubuntu 图形化界面登录,报错 sorry,that didn't work.please try again Mac 配置 WireGuard 客户端