oc-adm-drain man page
oc adm drain — Drain node in preparation for maintenance
oc adm drain [Options]
Drain node in preparation for maintenance.
The given node will be marked unschedulable to prevent new pods from arriving. 'drain' evicts the pods if the APIServer supports eviction ( ⟨http://kubernetes.io/docs/admin/disruptions/⟩). Otherwise, it will use normal DELETE to delete the pods. The 'drain' evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are DaemonSet-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by ReplicationController, ReplicaSet, DaemonSet, StatefulSet or Job, then drain will not delete any pods unless you use --force. --force will also allow deletion to proceed if the managing resource of one or more pods is missing.
When you are ready to put the node back into service, use kubectl uncordon, which will make the node schedulable again.
Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained).
If true, only print the object that would be sent, without sending it.
Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet.
Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used.
Ignore DaemonSet-managed pods.
Label selector to filter pods on the node
- -l, --selector=""
Selector (label query) to filter on
The length of time to wait before giving up, zero means infinite
Options Inherited from Parent Commands
Username to impersonate for the operation
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
Path to the file container Azure container registry configuration information.
Default HTTP cache directory
Path to a cert file for the certificate authority
Path to a client certificate file for TLS
Path to a client key file for TLS
The name of the kubeconfig cluster to use
Path to the config file to use for CLI requests.
The name of the kubeconfig context to use
The Google Cloud Platform Service Account JSON Key to use for authentication.
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
Require server version to match client version
- -n, --namespace=""
If present, the namespace scope for this CLI request
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
The address and port of the Kubernetes API server
Bearer token for authentication to the API server
The name of the kubeconfig user to use
Print version information and quit
# Drain node "foo", even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet on it. $ oc adm drain foo --force # As above, but abort if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet, and use a grace period of 15 minutes. $ oc adm drain foo --grace-period=900
June 2016, Ported from the Kubernetes man-doc generator