In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about the process of K8s operation and maintenance 06-kubectl delete node. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
one。 This section records the execution of kubectl delete node
Delete is a rough command, which will directly expel the pod on the deleted node and be created by other node (for replicaset), then remove the deleted node from the scope of master management, and master will lose management control over it. If you want to bring node back under control, you must restart kubelet on the node node.
Check all node in advance
Take the deletion of 10.5.0.45 as an example, you can see that the node exists
[root@k8smaster163075 ~] $kubectl get nodesNAME STATUS ROLES AGE VERSION10.5.0.44 Ready SchedulingDisabled 41h v1.11.310.5.0.45 Ready 41h v1.11.310.5.0.46 Ready 41h v1.11.310.5.0.47 Ready 41h v1.11.310.5.0.48 Ready 41h v1.11.310.5 .0.49 Ready 41h v1.11.3 View all pod
10.5.0.45 node has 4 pod
Image.png
Execute kubectl delete node 10.5.0.45 [root@k8smaster163075 ~] $kubectl get pods-n test-kubeasy-k8s-o wide | grep 10.5.0.45atlas-uat-deployment-5b65898567-85jpb 1 to 1 Running 0 14m 10.5.45.104 10.5.0.45atlas-uat-deployment-5b65898567-8l7gm 1 to 1 Running 0 41h 10.5.45.102 10.5.0.45atlas -uat-deployment-5b65898567-cqzj7 1 Running 0 41h 10.5.45.103 10.5.0.45 atlas-uat-deployment-5b65898567-lzp7k 1 Running 0 41h 10.5.45.101 10.5.0.45 [root@k8smaster163075 ~] $kubectl delete node 10.5.0.45node "10.5.0.45" deleted re-view pod See that 4 new pod have been built
Image.png
Master view all node
Node is no longer under the control of master.
Contrast kubectl drain/cordon node
[root@k8smaster163075 ~] $kubectl get nodesNAME STATUS ROLES AGE VERSION10.5.0.44 Ready SchedulingDisabled 41h v1.11.310.5.0.46 Ready 41h v1.11.310.5.0.47 Ready 41h v1.11.310.5.0.48 Ready 41h v1.11.310.5.0.49 Ready 41h v1.11.3ssh to 10.5.0.45 machines
Docker ps View Container is empty
Recovery of [root@docker000045.ppdgdsl.com ~] $docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESdelete Node
Restart Node kubelet
Enter master to view node. Node 10.5.0.45 appears. AGE=2m16s has just taken effect.
[root@k8smaster163075 ~] $kubectl get nodesNAME STATUS ROLES AGE VERSION10.5.0.44 Ready SchedulingDisabled 42h v1.11.310.5.0.45 Ready 2m16s v1.11.310.5.0.46 Ready 42h v1.11.310.5.0.47 Ready 42h v1.11.310.5.0.48 Ready 42h v1.11 .310.5.0.49 Ready 42 hours v1.11.3 di. Cordon,drain,delete node distinction
All three commands will cause the node to stop being scheduled, and the later created pod will not continue to be dispatched to the node, but the operation varies in degree of violence.
Cordon stops scheduling
The impact is minimal, only node will be adjusted to SchedulingDisabled.
Create pod after that, and will not be dispatched to this node.
The old pod will not be affected and will still provide services normally.
Resume scheduling
Kubectl uncordon node_namedrain expelling node
First, expel the pod on the node and recreate the other nodes
Next, set the node to * * SchedulingDisabled**
Resume scheduling
Kubectl uncordon node_namedelete Delete Node
First, expel the pod on the node and recreate the other nodes
Then, delete the node,master from the master node to be invisible, lose control over it, and master cannot restore it
To resume scheduling, you need to enter the node node and restart kubelet
Based on the self-registration function of node, the node resumes its use
Systemctl restart kubelet above is the process of K8s operation and maintenance 06-kubectl delete node shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.