Kubernetes/使用文档/Kubernetes节点常用操作.md
offends 7a2f41e7d6
All checks were successful
continuous-integration/drone Build is passing
synchronization
2024-08-07 18:54:39 +08:00

62 lines
870 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

> 本文作者:丁辉
# Kubernetes节点常用操作
## 允许节点加入集群
1. 查看待加入节点
```bash
kubectl get csr
```
2. 查看节点信息
```bash
kubectl describe csr $name
```
3. 批准加入
```bash
kubectl certificate approve $name
```
4. 查看结果
```bash
kubectl get csr
#CONDITION=Approved,Issued
```
## 删除节点
> 在删除节点前要先排空节点上POD
1. 排空POD
```bash
kubectl drain <node name> --delete-local-data --force --ignore-daemonsets
```
2. 删除节点
```bash
kubectl delete node <node name>
```
## 给节点打标签
- `Master` 打标签
```bash
kubectl label node 192.168.1.10 node-role.kubernetes.io/master='k8s-master1'
```
- `Node` 打标签
```bash
kubectl label node ${node} node-role.kubernetes.io/worker=true
```