查看现有状态

[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master NotReady control-plane 72s v1.25.0
node1 NotReady <none> 11s v1.25.0
node2 NotReady <none> 7s v1.25.0

一、驱逐节点

[root@master ~]# kubectl cordon node1
node/node1 cordoned
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master NotReady control-plane 7m4s v1.25.0
node1 NotReady,SchedulingDisabled <none> 6m3s v1.25.0
node2 NotReady <none> 5m59s v1.25.0

二、删除该节点

[root@master ~]# kubectl delete node node1
node "node1" deleted
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master NotReady control-plane 7m13s v1.25.0
node2 NotReady <none> 6m8s v1.25.0

三、若需要重新部署该节点

  • 在该节点上执行kubeadm reset
[root@node1 ~]# kubeadm reset
W1123 18:03:42.930664 15464 preflight.go:55] [reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
[reset] Are you sure you want to proceed? [y/N]: y
W1123 18:03:45.173129 15464 removeetcdmember.go:85] [reset] No kubeadm config, using etcd pod spec to get data directory
[reset] No etcd config found. Assuming external etcd
[reset] Please, manually reset etcd to prevent further issues
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[reset] Deleting contents of directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
[reset] Deleting contents of stateful directories: [/var/lib/kubelet] The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d The reset process does not reset or clean up iptables rules or IPVS tables.
If you wish to reset iptables, you must do so manually by using the "iptables" command. If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
to reset your system's IPVS tables. The reset process does not clean your kubeconfig files and you must remove them manually.
Please, check the contents of the $HOME/.kube/config file. 

四、设置节点为不可调度

[root@master ~]# kubectl  drain 【节点名】 --ignore-daemonsets

  

k8s 删除 node节点的更多相关文章

  1. k8s集群-node节点设置不可调度或者删除node节点

    在master 执行1, 不可调度 kubectl cordon k8s-node- kubectl uncordon k8s-node- #取消 2,驱逐已经运行的业务容器 kubectl drai ...

  2. k8s kubernetes给node节点添加标签和删除node节点标签

    node节点IP 192.168.1.205 给节点添加标签的命令 添加label语法 kubectl label nodes <node-name> <label-key>= ...

  3. centos8平台redis cluster集群添加/删除node节点(redis5.0.7)

    一,当前redis cluster的node情况: 我们的添加删除等操作都是以这个cluster作为demo cluster采用六台redis,3主3从 redis1 : ip: 172.17.0.2 ...

  4. raspberrypi系统在加入k8s作为node节点时遇到的问题

    新买的树莓派4b到货后就迫不及待的烧录上raspberrypi系统,将新派加入我的k8s集群,期间遇到了点小挫折,好歹也一个一个解决了: 一.kubelet版本不对导致无法加入k8s集群 在执行kub ...

  5. 第三章 k8s的node节点配置

    一.修改主机名 hostnamectl set-hostname xxx 二.修改hosts文件vim /etc/hosts 三.将写好的hosts文件拷贝到其他节点 scp /etc/hosts r ...

  6. k8s的node节点无法调度的问题

    1.现象,创建deployment时 2.查看污点 [fedora@k8s-cluster--ycmwlao4q5wz-master- ~]$ kubectl describe node k8s-cl ...

  7. k8s的node节点,执行kubectl get XXX报错

    报错现象: [root@localhost ~]# kubectl get nodes The connection to the server localhost:8080 was refused ...

  8. k8s删除一个Node并重新加入集群

    k8s删除一个节点使用以下命令 删除一个节点前,先驱赶掉上面的pod kubectl drain 172.17.3.51 --delete-local-data 然后我们来删除节点 kubectl d ...

  9. 重置node节点

    删除node节点 删除通过csr请求后产生的所有文件和证书 [root@lab1 ~]# rm -rf /etc/kubernetes/kubelet.conf [root@lab1 ~]# rm - ...

  10. Kubernetes移除node节点

    1.kubectl delete node {{节点名称}} 2.删除node节点上由kubelet自动生成的kubelet.kubeconfig配置文件,和ssl密钥证书kubelet.key,ku ...

随机推荐

  1. MySQL 合并查询union 查询出的行合并到一个表中

    在合并查询中,尤其是二分类的情况,在查询结果是相同列名的时候可以考虑合并查询.先查询出行的结果,再使用union或者union all合并查询结果. 另外如果 union 和 order by 一起使 ...

  2. 构造方法-JavaBean

    构造方法 当一个对象被创建时候,构造方法用来初始化该对象,给对象的成员变量赋初始值. 小贴士:无论你与否自定义构造方法,所有的类都有构造方法,因为Java自动提供了一个无参数构造方法, 一旦自己定义了 ...

  3. ADC-单通道DMA到多通道DMA ADC采集修改事项

    1. 使能通道IO,因为从单通道到多通道,需要添加规则转换通道数,故需要使能扫描模式,否则只能扫描第一个通道: 2. DMA模式配置需修改为循环传输模式,否则只转换一次: 3. 开启ADC规则转换通道 ...

  4. 鸣人的影分身(等级考试4级 2021-03 T3)

    题目: 此题题干又臭又长,直接看简化版. 鸣人的影分身(等级考试4级 2021-03 T3)等效于 把m个苹果分到n个盘子中,问有几种可能? dp[i][j]表示有i个盘子j个苹果时有多少种放法. 用 ...

  5. 获取Excel列标

    /// <summary> /// 获取Excel列标 A B C...Z等 /// </summary> /// <param name="col" ...

  6. P4_创建第一个小程序项目

    设置外观和代理 创建小程序项目 点击"加号"按钮 填写项目信息 项目创建完成 在模拟器上查看项目效果 在真机上预览项目效果 主界面的 5 个组成部分

  7. Docker安装Tomcat应用服务器

    1.安装镜像 1. Install the image: 可以先到https://hub.docker.com/  搜索镜像 You can get there first. https://hub. ...

  8. vim编辑器操作指南

    编辑模式(i) yy复制行 p粘贴 dd剪切 V按行选中 u撤销 ctr+r反撤销 >>往右缩进 <<往左缩进 :/...搜索指定内容 .重复上一次命令 G回到最后一行 gg回 ...

  9. 【USACO 2021 US Open, Gold】Permutation

    \(\text{Solution}\) 发现每个时刻的状态一定是所有点在一个最外围三角形的内部 设 \(f_{i,j,k,p}\) 表示排列填到第 \(p\) 位,此时图形最外围的三角形是以编号为 \ ...

  10. python破解zip或者rar压缩文件

    转载博客园python大师:https://www.cnblogs.com/daniumiqi/p/12167764.html