Linux随记(十八)
一、k8s的node节点磁盘 /data已使用率超过 85% , 出现disk pressure ,驱逐pod现象
evicted , the node had condition:[DiskPressure]
#修改/var/lib/kubelet/config.yaml
]# cat /var/lib/kubelet/config.yaml
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:anonymous:enabled: falsewebhook:cacheTTL: 0senabled: truex509:clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:mode: Webhookwebhook:cacheAuthorizedTTL: 0scacheUnauthorizedTTL: 0s
cgroupDriver: systemd
clusterDNS:
- 10.96.0.10
clusterDomain: cluster.local
cpuManagerReconcilePeriod: 0s
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMinimumGCAge: 0s
kind: KubeletConfiguration
logging:flushFrequency: 0options:json:infoBufferSize: "0"verbosity: 0
memorySwap: {}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
rotateCertificates: true
runtimeRequestTimeout: 0s
shutdownGracePeriod: 0s
shutdownGracePeriodCriticalPods: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s#202506 添加:
evictionHard:imagefs.available: 1%memory.available: 100Minodefs.available: 1%nodefs.inodesFree: 1%#重启该node节点的 kubelet
systemctl restart kubelet
systemctl status kubelet
#参考文章:
https://blog.csdn.net/qq_59634082/article/details/136868417 《k8s资源不足时驱赶pod阈值调整》
https://stackoverflow.com/questions/54155534/kubernetes-eviction-manager-evicting-control-plane-pods-to-reclaim-ephemeral-sto/60068671#60068671
https://devpress.csdn.net/k8s/62ffc7fac67703293080625f.html 《Kubernetes 驱逐管理器驱逐控制平面 pod 以回收临时存储》
END
二、删除ES索引和其数据。
k8s上部署3个ES节点 , 版本elasticsearch:7.6.0 。 删除索引名称带202407的索引。kubectl exec -it es-new-0 -n test bash
#查看索引名称
curl -s "http://192.168.1.100:9200/_cat/indices?h=index" | grep -i "202407"
#删除索引 【三个ES节点的IP 都要执行】
curl -X DELETE "http://192.168.1.100:9200/api_xxx_202407*"
curl -X DELETE "http://192.168.1.101:9200/api_xxx_202407*"
curl -X DELETE "http://192.168.1.102:9200/api_xxx_202407*"###查看占用容量 , 单位MB
curl "http://192.168.1.100:9200/_cat/allocation?v&bytes=gb"
curl "http://192.168.1.100:9200/_cat/indices/api_xxx_202407*?v&h=index,store.size,pri.store.size,status&bytes=mb&s=store.size:desc"
参考文章:
https://blog.csdn.net/weixin_44711737/article/details/125833601 《ES索引清理脚本-总结》 (清理脚本:ES有密码,索引按(周、日)时间命名的清理脚本)
END