2. Nodes资源管理
2.1 查看资源的简略信息
kubectl get nodes # 解析: NAME:node的名称 STATUS:node的状态 ROLES: node的角色 AGE:node的生命周期 VERSION:kubernetes版本
kubectl get nodes -o wide # 解析: INTERNAL-IP::内部IP EXTERNAL-IP:外部IP OS-IMAGE:系统版本 KERNEL-VERSION;系统内核版本 CONTAINER-RUNTIME:container runtime的版本
2.3 查看资源的详细信息
kubectl describe nodes master01 # 解析: capacity:描述节点上的总资源:CPU、内存和可以调度到节点上的最pod数量; allocatable: 描述可分配的资源; conditions: MemoryPressure: status: True 节点内存存在压力或者不足 status: False 节点内存正常无压力 DiskPressure: status: True 磁盘容量存在压力或者容量低 status: False 磁盘容量正常无压力 PIDPressure: status: True 进程上存在压力或者进程过多 status: False 进程正常无压力 Ready: status: True 节点是健康正常 status: False 节点不健康 OutOfDisk: status: True 如果节点上没有足够的空闲空间来添加新的pod status: False 节点上有空闲的空间 NetworkUnavailable: status: True 节点的网络配置不正确 status: False 节点的网络配置正确
2.4 查看资源的yaml文件格式
kubectl get nodes master01 -o yaml
2.5 查看资源的json文件格式
kubectl get nodes master01 -o json
3. Label与Annotation
3.1 Label
查看资源的标签信息
kubectl get nodes --show-labels
或者
kubectl describe nodes node01
Label的添加与删除,Key必须存在且唯一,Value可以为空、且不唯一
# 添加Label
kubectl label nodes node01 node-role.kubernetes.io/work=
# 删除Label
kubectl label nodes node01 node-role.kubernetes.io/work-
查看node的角色
kubectl get nodes
查看Annotation
kubectl describe resource_type/resource_name
Annotation的添加与删除,#Key必须存在且唯一,Value可以为空、且不唯一
添加Annotation
kubectl annotate resource_type resource_name key=value
# 删除Annotation
kubectl annotate resource_type resource_name key-