大家在k8s實(shí)際的使用中或許會(huì)碰到這個(gè)現(xiàn)象赠涮,就是pod到達(dá)一定的數(shù)量,明明節(jié)點(diǎn)內(nèi)存還有很多但是為什么就是不讓新建pod了呢傲茄,我來(lái)和大家說(shuō)下
默認(rèn)情況下k8s 一個(gè)node最多起110個(gè)pod.
那么如何修改一個(gè)node中起的pod數(shù)量呢隔心?
在Node上 設(shè)置打開(kāi)文件/var/lib/kubelet/config.yaml
修改參數(shù)maxPods為指定的值,這里我們把它修改為230:
clusterDomain: cluster.local
cpuManagerReconcilePeriod: 0s
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMinimumGCAge: 0s
kind: KubeletConfiguration
logging: {}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
resolvConf: /run/systemd/resolve/resolv.conf
rotateCertificates: true
runtimeRequestTimeout: 0s
shutdownGracePeriod: 0s
shutdownGracePeriodCriticalPods: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
maxPods: 230
修改完之后重啟下面的服務(wù)
systemctl daemon-reload?
systemctl restart kubelet
查詢(xún)狀態(tài):
$ kubectl describe node host07??|??grep -i "Capacity\|Allocatable" -A 6
Capacity:
??cpu:????????????????192
??ephemeral-storage:??9298787068Ki
??hugepages-1Gi:??????0
??hugepages-2Mi:??????0
??memory:?????????????1056273036Ki
??pods:???????????????230
Allocatable:
??cpu:????????????????192
??ephemeral-storage:??8569762147680
??hugepages-1Gi:??????0
??hugepages-2Mi:??????0
??memory:?????????????1056170636Ki
??pods:???????????????230
從上面可以清晰的看到pods限制的數(shù)量已經(jīng)被修改為230個(gè)了竟痰,問(wèn)題解決