登录到k8s的节点服务器上,编辑配置文件
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf


修改之前:

[Service]
Environment="KUBELET_EXTRA_ARGS=--node-labels=alibabacloud.com/nodepool-id=npf3340fea4f0841abbd46b9d4bf9a7b4a,ack.aliyun.com=c46a97d8102dc42148a09dbda683d0c0c"
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=--container-log-max-files 10 --container-log-max-size=100Mi --max-pods 16 --pod-max-pids 16384 --pod-manifest-path=/etc/kubernetes/manifests"
Environment="KUBELET_LOGLEVEL_ARGS=--v=3"
Environment="KUBELET_DNS_ARGS=--enable-controller-attach-detach=true --cluster-dns=172.17.0.10         --pod-infra-container-image=registry-vpc.cn-hangzhou.aliyuncs.com/acs/pause:3.5 		--enable-load-reader --cluster-domain=cluster.local --cloud-provider=external         --hostname-override=cn-hangzhou.192.168.10.134 --provider-id=cn-hangzhou.i-bp1hqi40r9fpwr2ibib9 --serialize-image-pulls=false"
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_LOGLEVEL_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS $KUBELET_CUSTOMIZED_ARGS --container-runtime=remote --container-runtime-endpoint=/var/run/containerd/containerd.sock

添加如下:
Environment="KUBELET_NODE_MAX_PODS=--max-pods=256"
ExecStart=/usr/bin/kubelet   $KUBELET_NODE_MAX_PODS


[Service]
Environment="KUBELET_EXTRA_ARGS=--node-labels=alibabacloud.com/nodepool-id=npf3340fea4f0841abbd46b9d4bf9a7b4a,ack.aliyun.com=c46a97d8102dc42148a09dbda683d0c0c"
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=--container-log-max-files 10 --container-log-max-size=100Mi --max-pods 16 --pod-max-pids 16384 --pod-manifest-path=/etc/kubernetes/manifests"
Environment="KUBELET_LOGLEVEL_ARGS=--v=3"
Environment="KUBELET_DNS_ARGS=--enable-controller-attach-detach=true --cluster-dns=172.17.0.10         --pod-infra-container-image=registry-vpc.cn-hangzhou.aliyuncs.com/acs/pause:3.5 		--enable-load-reader --cluster-domain=cluster.local --cloud-provider=external         --hostname-override=cn-hangzhou.192.168.10.134 --provider-id=cn-hangzhou.i-bp1hqi40r9fpwr2ibib9 --serialize-image-pulls=false"
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"

# 添加如下Environment,然后在ExecStart中添加$KUBELET_NODE_MAX_PODS
Environment="KUBELET_NODE_MAX_PODS=--max-pods=256"

ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_LOGLEVEL_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS $KUBELET_CUSTOMIZED_ARGS $KUBELET_NODE_MAX_PODS --container-runtime=remote --container-runtime-endpoint=/var/run/containerd/containerd.sock


重启/验证kubelet:

> systemctl daemon-reload
> systemctl restart kubelet


 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐