一些概念
在 Kubernetes 中,通常每个应用程序由一个 Deployment 表示,它管理一组运行该应用的 Pods。所以,统计 Deployment 的数量可以帮助你了解有多少个应用在集群中。
根据你之前的命令,似乎只有一个名为 "blue" 的 Deployment。因此,答案应该是 1 个应用。
一些技巧

任务和回答
We need to take node01 out for maintenance. Empty the node of all applications and mark it unschedulable.
kubectl drain node01 --ignore-daemonsets
"–ignore-daemonsets" 这部分的意思是忽略 DaemonSet 相关的 Pod,不会把它们也一并驱逐掉。
kubectl drain 命令的作用是让节点进入维护状态,把节点上的所有 Pod(除了 DaemonSet 和一些特定情况)都迁移到其他节点上,方便进行维护或升级。它会安全地停止节点上的 Pod,确保集群的正常运行。
DaemonSet 是 Kubernetes 中的一种控制器,用于确保在集群中的每个节点上都运行一个特定的 Pod,比如日志收集、监控或网络插件等。它的作用就像“守护程序”,在每个节点上都守护着一份任务。
任务和回答
The maintenance tasks have been completed. Configure the node node01 to be schedulable again.
kubectl uncordon node01
uncordon 的作用是让之前被标记为不可调度(unschedulable)的节点变回可调度状态,也就是说,允许新的 Pod 被调度到这个节点上,就像把节点“解封”一样,让它重新加入到集群的工作中。
但是新pod创建才会调度到node01上

任务和回答
Why did the drain command fail on node01? It worked the first time!
Sure! The key point is that the kubectl get pods -o wide command shows all pods and their nodes. If a pod isn't part of a ReplicaSet, it might be a standalone pod, which can cause issues when draining nodes because Kubernetes prefers to manage pods via ReplicaSets for graceful handling. In your case, the pod hr-app on node01 isn't part of a ReplicaSet, so the drain command may fail unless you use --force.
A forceful drain of the node will delete any pod that is not part of a replicaset.
任务和回答

当你强制驱逐(drain)node01时,hr-app这个Pod会被删除(evicted)掉,因为它没有被控制器(如Deployment)管理,属于孤立的Pod。这样,hr-app就会“消失”在集群中,无法继续运行,直到你重新在其他节点上部署它。
简而言之:hr-app会丢失,无法自动恢复。
任务和回答

区别cordon和uncordon

任务和回答
