阿里云k8s扩展node节点最大pod数量(两种方式)
其实就是 修改 kubelet 启动参数 max-pods 默认是 110
注意:
使用阿里云 ECS 搭建的 K8S 集群(使用terway网络插件即POD使用弹性网卡), 节点所支持的容器网络Pod数量 是 受ECS规格的影响 的
terway 使用 ecs 作为 node 时,每个 ecs 支持的最大 pod 数目为: (ECS规格支持的弹性网卡数-1)× 单个ENI支持的私有IP数
Terway会接管Terway网络集群节点上eth0之外的弹性网卡用于配置Pod网络,因此不能手动配置额外的弹性网卡。
方法一:
vim /etc/systemd/system/kubelet.service.d/10-kubeadm.conf [Service] EnvironmentFile=-/etc/kubernetes/kubelet-customized-args.conf Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" Environment="KUBELET_SYSTEM_PODS_ARGS=--max-pods 64 --pod-manifest-path=/etc/kubernetes/manifests" Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin --dynamic-config-dir=/etc/kubernetes/kubelet-config --v=3" Environment="KUBELET_DNS_ARGS=--enable-controller-attach-detach=true --cluster-dns=172.26.0.10 --pod-infra-container-image=registry-vpc.cn-hangzhou.aliyuncs.com/acs/pause:3.2 --enable-load-reader --cluster-domain=cluster.local --cloud-provider=external --hostname-override=cn-hangzhou.172.16.214.136 --provider-id=cn-hangzhou.i-bp1jbs6mikeqdurclkzn" Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --authentication-token-webhook=true --anonymous-auth=false --client-ca-file=/etc/kubernetes/pki/ca.crt" Environment="KUBELET_CGROUP_ARGS=--cgroup-driver=systemd" Environment="KUBELET_CERTIFICATE_ARGS=--tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256 --tls-cert-file=/var/lib/kubelet/pki/kubelet.crt --tls-private-key-file=/var/lib/kubelet/pki/kubelet.key --rotate-certificates=true --cert-dir=/var/lib/kubelet/pki" ExecStart= ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS $KUBELET_CUSTOMIZED_ARGS ~
增加如下字段
Environment="KUBELET_NODE_MAX_PODS=--max-pods=256" ExecStart=/usr/bin/kubelet $KUBELET_NODE_MAX_PODS
重启 kubelet
[root@k8s1 ~]# systemctl daemon-reload [root@k8s1 ~]# systemctl restart kubelet
验证:
describe node node-01 |grep -i "Capacity\|Allocatable" -A 6 Capacity: cpu: 8 ephemeral-storage: 206292644Ki hugepages-1Gi: 0 hugepages-2Mi: 0 memory: 65705484Ki pods: 256 Allocatable: cpu: 8 ephemeral-storage: 190119300396 hugepages-1Gi: 0 hugepages-2Mi: 0 memory: 64681484Ki pods: 256
方法二
修改节点配置文件 /var/lib/kubelet/config.yaml 并增加高亮处配置
maxPods: 256
重启 kubelet
0顶
0 踩
共 0 条评论