Linux command
kubectl-cordon 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Cordon node
kubectl cordon [node-name]
Cordon multiple nodes
kubectl cordon [node1] [node2]
Cordon with selector
kubectl cordon -l [key=value]
Dry run
kubectl cordon [node-name] --dry-run=client
说明
kubectl cordon marks one or more Kubernetes nodes as unschedulable by setting the `node.kubernetes.io/unschedulable` taint on the node object. Once cordoned, the scheduler will not place any new pods on the node, but existing pods already running on it continue to operate normally and are not affected. Cordoning is typically the first step in a node maintenance workflow, followed by `kubectl drain` to gracefully evict the running pods. It is also useful for isolating a node that is exhibiting problems -- such as high resource usage or hardware errors -- while you investigate, without disrupting workloads already running there. To return a cordoned node to normal scheduling, use `kubectl uncordon`. The cordon state can be verified by checking the node's status with `kubectl get nodes`, where cordoned nodes display a `SchedulingDisabled` status.
参数
- -l _SELECTOR_
- Label selector.
- --dry-run _MODE_
- Simulate operation.
- --help
- Display help information.
FAQ
What is the kubectl-cordon command used for?
kubectl cordon marks one or more Kubernetes nodes as unschedulable by setting the `node.kubernetes.io/unschedulable` taint on the node object. Once cordoned, the scheduler will not place any new pods on the node, but existing pods already running on it continue to operate normally and are not affected. Cordoning is typically the first step in a node maintenance workflow, followed by `kubectl drain` to gracefully evict the running pods. It is also useful for isolating a node that is exhibiting problems -- such as high resource usage or hardware errors -- while you investigate, without disrupting workloads already running there. To return a cordoned node to normal scheduling, use `kubectl uncordon`. The cordon state can be verified by checking the node's status with `kubectl get nodes`, where cordoned nodes display a `SchedulingDisabled` status.
How do I run a basic kubectl-cordon example?
Run `kubectl cordon [node-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -l _SELECTOR_ do in kubectl-cordon?
Label selector.