升级过程中会用到的几个命令。
cordon:标记节点unschedulable。
drain:删除节点上的pods。如果APIserver支持eviction(http://kubernetes.io/docs/admin/disruptions/).操作,那么就会将pods移动到其他节点。否则,drain将会删除这些pods,但是无法删除mirror pods。此外如果有DaemonSet管理的pods,不带--ignore-daemonsets参数的话drain不会处理这类pods,会中断操作,因为DaemonSet Controller会忽略unschedule标记立刻重新创建pod。如果没有mirror pods或受ReplicationController、ReplicaSet、DaemonSet、StatefulSet 或Job管理的pods,drain也不会删除任何pods,除非使用--force参数,drain才会删除相关资源。
示例:
# kubectl drain node1
node "node1" already cordoned
error: unable to drain node "node1", aborting command...
There are pending nodes to be drained:
node1
error: DaemonSet-managed pods (use --ignore-daemonsets to ignore): calico-node-27jxt, fluentd-es-pp2pp, kube-proxy-b4q57, nginx-ingress-controller-sl4p5, node-exporter-6tkz8; pods with local storage (use --delete-local-data to overrid