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

870 B
Raw Blame History

本文作者:丁辉

Kubernetes节点常用操作

允许节点加入集群

  1. 查看待加入节点

    kubectl get csr
    
  2. 查看节点信息

    kubectl describe csr $name
    
  3. 批准加入

    kubectl certificate approve $name
    
  4. 查看结果

    kubectl get csr
    #CONDITION=Approved,Issued
    

删除节点

在删除节点前要先排空节点上POD

  1. 排空POD

    kubectl drain <node name> --delete-local-data --force --ignore-daemonsets
    
  2. 删除节点

    kubectl delete node <node name>
    

给节点打标签

  • Master 打标签

    kubectl label node 192.168.1.10 node-role.kubernetes.io/master='k8s-master1'
    
  • Node 打标签

    kubectl label node ${node} node-role.kubernetes.io/worker=true