Skip to content

kubectl drain --disable-eviction --dry-run=server hangs indefinitely #1830

@kfess

Description

@kfess

What happened:

kubectl drain --disable-eviction --dry-run=server target-node hangs indefinitely when there are pods on the target node.

What you expected to happen:

The command should complete immediately without hanging, as it does with --dry-run=client or without --disable-eviction.

How to reproduce it (as minimally and precisely as possible):

# With kind multi-node cluster
kubectl apply -f pod.yaml (any pod manifest)
kubectl drain kind-worker --disable-eviction --ignore-daemonsets --dry-run=server
# Hangs here indefinitely

Anything else we need to know?:

I think it appears that the deletePods path (used when --disable-eviction is set) enters waitForDelete after sending the dry-run delete request, waiting for pods that are never actually removed.

https://github.com/kubernetes/kubernetes/blob/fbe282098364806aed50a44fa69bcd2a0fc2ad8b/staging/src/k8s.io/kubectl/pkg/drain/drain.go#L411

Environment:

  • Kubernetes version: v1.35
  • OS: Linux

/sig cli
/kind bug
/area kubectl
/assign

Metadata

Metadata

Assignees

Labels

area/kubectlkind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions