💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ## 二进制 ### 查看集群情况 ```shell $ kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master01 Ready master 48d v1.18.18 k8s-master02 Ready master 48d v1.18.18 k8s-node01 Ready <none> 48d v1.18.18 k8s-node02 Ready <none> 48d v1.18.18 k8s-node03 Ready <none> 48d v1.18.18 ``` ### 停止调度 ```shell $ kubectl cordon k8s-master02 node/k8s-master02 cordoned ``` ### 驱逐pod ```shell $ kubectl drain --ignore-daemonsets --delete-local-data k8s-master02 node/k8s-master02 already cordoned WARNING: ignoring DaemonSet-managed Pods: kube-mon/node-exporter-42s9m, kube-system/calico-node-wgpkn node/k8s-master02 drained ``` ### 停止服务 ```shell $ systemctl stop kubelet kube-proxy ``` ### 删除节点 ```shell $ kubectl delete node k8s-master02 node "k8s-master02" deleted ``` ### 确认kubelet数据目录 ```shell $ cat /data/k8s/conf/kubelet.conf KUBELET_OPTS="--alsologtostderr=true \ --logtostderr=false \ --v=4 \ --log-dir=/data/k8s/logs/kubelet \ --hostname-override=k8s-master02 \ --network-plugin=cni \ --cni-conf-dir=/etc/cni/net.d \ --cni-bin-dir=/opt/cni/bin \ --kubeconfig=/data/k8s/certs/kubelet.kubeconfig \ --bootstrap-kubeconfig=/data/k8s/certs/bootstrap.kubeconfig \ --config=/data/k8s/conf/kubelet-config.yaml \ --cert-dir=/data/k8s/certs/ \ --pod-infra-container-image=ecloudedu/pause-amd64:3.0" ``` > 确认是否有 `root-dir` 参数。如果有的话,那kubelet数据就存放在该目录下,默认在 `/var/lib/kubelet` 目录下 ### 确认docker数据目录 ```shell $ cat /data/docker/conf/daemon.json { "data-root": "/data/docker/data/", "exec-opts": ["native.cgroupdriver=systemd"], "registry-mirrors": [ "https://1nj0zren.mirror.aliyuncs.com", "https://docker.mirrors.ustc.edu.cn", "http://f1361db2.m.daocloud.io", "https://registry.docker-cn.com" ] } ``` > 确认是否有 `data-root 或者 graph` 参数。如果有的话,那docker数据就存放在该目录下,默认在 `/var/lib/docker` 目录下 ### 清理docker环境 ```shell $ docker system prune -af Deleted Containers: a0c332924f18858a4bc113b4677c3c809693167a8e4c43ec9034f307789f9302 1a1080345aa328c739dde0b0ade040260cb75b62fffd71fcc5efb2c3238891a0 78aaf0c008d412497b287ccc0279c0d96b907511ef2260ed245411dfdb93244a 320e0fafe7d4148e2ad68d118da9c96549b5cf6a1d22d9fd5f019af4deb41e74 c39d21b376d9fa77cd8fa85b4e726a11efc6a2eb50e0cb704dcd1553bf1f1367 315aa9b5d36498189b4f863769e27b7790f4608cc5102adfbcd177b1ba5d9818 Deleted Images: untagged: calico/node:v3.18.6 untagged: calico/node@sha256:36be4cb9ebe1616d33fbcddffef0e82ce458db60f6af5e534c85c10653f47f6b deleted: sha256:13143ba4a4e2bcc773e00590f635bcf9d66e411dc508964053b229c2d7625549 deleted: sha256:fce8c470bff7e58c132f2a3f532ce6708b0b1bb7527f1de0e25fa848e768f666 deleted: sha256:9ee1dc4b503dadee2a0ad8c13a9bab8794eb7099f56b36c9ad2fde571f27b5fc untagged: prom/node-exporter:v1.1.1 untagged: prom/node-exporter@sha256:5982c5e716c32a9ec5032b6b86be054a9abe911e3c79b376a7f011d2a7551add deleted: sha256:15a32669b6c2116e70469216e8350dbd59ebd157f0fc6eb4543b15e6239846c0 deleted: sha256:f020a746d039bca27138f0ce7a4379d06e3f26ea961ac2210c01b82994dddd31 deleted: sha256:6d7f39eeb256633aed06806aea7f73a379ab38734e33dfbe2cef98369dbd5c8d deleted: sha256:4de246f79fafeababec70d1aa84bc7158a31f59fbec987bc6a09107f9ffa5307 untagged: calico/cni:v3.18.6 untagged: calico/cni@sha256:50fedf3349c647191cc03b023f00d446fb55e0a302cb2ea5eb2e55e47da7614c deleted: sha256:1f4b3a79aa0e7e4b33d0081d7e7d49f5c7966351c5e66160b41e00340ddac87e deleted: sha256:74beb3a20f1c76aacc30d44074ac86c402325051b78ad2baed15c355d34d577e deleted: sha256:4ddffbe7a9a76dbf88ce8af8ae7e3344e5acf8436da98e5694a537a237f0864a deleted: sha256:b52b7b8a27a6c0a2bab76736a5909c089312f7f61b2ae8d4e49c3ea13c6c73e8 untagged: calico/pod2daemon-flexvol:v3.18.6 untagged: calico/pod2daemon-flexvol@sha256:9d4fa2f5cc456e4627cac5a659e4a5f1b007e98bd469e6b74f24280b71e9883a deleted: sha256:3d0771521a982a17095a855a377c18e08392b1b686c71f17d3dc20b56c092f5d deleted: sha256:252205e4909c8bae5f8123f051c15a89c43c04c7a979d94f885b4b54aa5a7fb0 deleted: sha256:c4fbfbd148c3733dad69cfabf16bacf63969a11dd61566bcb440a0ed1c4bb337 deleted: sha256:55ab1b0ba0643fed84cb130d2830aa419495f1fdc387336d74adcd9466def854 deleted: sha256:46fb51f14d2a1c51af6a6a767269bf2c76e7d7740e59d3b12c063924cddf1bd4 deleted: sha256:97a662d42ccd03d571bb6f4a7ed0af6601a0b132ab5bcee7aab12cce46c7b354 deleted: sha256:8d19f98506479bd64e10a42c10a1dc3e8af3083447bf50a5c39645ab06fabacb deleted: sha256:d2cfc94608a26afb5d4421a53eab2505f1da23144db41b6748f418efa7e07c42 untagged: ecloudedu/pause-amd64:3.0 untagged: ecloudedu/pause-amd64@sha256:f04288efc7e65a84be74d4fc63e235ac3c6c603cf832e442e0bd3f240b10a91b deleted: sha256:99e59f495ffaa222bfeb67580213e8c28c1e885f1d245ab2bbe3b1b1ec3bd0b2 deleted: sha256:666604249ff52593858b7716232097daa6d721b7b4825aac8bf8a3f45dfba1ce deleted: sha256:7897c392c5f451552cd2eb20fdeadd1d557c6be8a3cd20d0355fb45c1f151738 deleted: sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef Total reclaimed space: 388.9MB $ systemctl stop docker ``` ### 取消docker挂载目录 ```shell $ umount $(df -HT | grep '/var/lib/kubelet/pods' | awk '{print $7}') $ rm -rf /var/lib/kubelet/ /data/docker/data/ ``` ### 删除k8s网络插件目录 ```shell $ rm -rf /opt/cni/bin /etc/cni/net.d /var/lib/cni ``` ### 删除k8s的systemd文件 ```shell $ rm -rf /usr/lib/systemd/system/kubelet.service /usr/lib/systemd/system/kube-proxy.service ``` > 自行清理k8s自定的目录以及相关命令