#设置alias,省点力气
echo "alias k='kubectl'" >> ~/.bashrc
1.伸缩
k scale deploy -n test nginx --replicas=3
2.批量删除test命名空间下的Evicted pod
k get pods --all-namespaces -owide| grep -v Run|grep Evicted|awk -F ' ' '{print $2}'|xargs kubectl delete pod -n test
3.如果删除pod时删不掉,可强制处理
k delete pod -n test --force --grace-period=0
4.问题KubeletNotReady-[container runtime is down, PLEG is not healthy
重启docker 然后重启kubelet ;
systemctl restart docker
systemctl restart kubelet
systemctl status kubelet
5.问题 too many pods
k get no node1 -oyaml |grep pods
vim /var/lib/kubelet/config.yaml
#修改maxPods后
systemctl restart kubelet
6.问题 释放/var/lib空间多余占用
#/var/lib空间占用
vim /etc/docker/daemon.json
按需调整"log-opts": 的,以减少/va/lib/ 的pod log日志占用空间 "max-file": "10", "max-size": "100m"
systemctl daemon-reload ;systemctl restart docker