Kubernetes
Pod Migration
Node Management
DevOps
Container Orchestration

How to move a pod from one node to another in kubernetes

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

Kubernetes does not provide a direct "move this running pod to another node" command. Pods are disposable scheduling units, so the normal way to relocate one is to make the current placement invalid, then let the scheduler create a replacement on a different node.

The exact method depends on the kind of workload. A pod owned by a Deployment or StatefulSet can usually be rescheduled safely. A standalone pod has no controller behind it, so deleting it simply removes it unless you recreate it yourself.

Use Cordon and Drain for Node-Level Moves

If the goal is to empty a node for maintenance, cordon and drain are the standard tools. cordon prevents new pods from landing on the node, and drain evicts movable pods so their controllers can recreate them elsewhere.

bash
kubectl cordon node-a
kubectl drain node-a --ignore-daemonsets --delete-emptydir-data

Once maintenance is complete, allow scheduling again:

bash
kubectl uncordon node-a

This is the safest cluster-operations workflow because it works with the scheduler instead of fighting it. It also makes the node state visible to other operators.

Move One Managed Pod by Changing Scheduling Conditions

If you only need to relocate a single pod from a Deployment, ReplicaSet, or StatefulSet, deleting the pod can be enough, but only if something about scheduling changes. Otherwise the replacement may land back on the same node.

One common approach is to label the destination node and use node affinity in the workload spec:

bash
kubectl label node node-b workload=batch
yaml
1apiVersion: apps/v1
2kind: Deployment
3metadata:
4  name: my-app
5spec:
6  replicas: 1
7  selector:
8    matchLabels:
9      app: my-app
10  template:
11    metadata:
12      labels:
13        app: my-app
14    spec:
15      affinity:
16        nodeAffinity:
17          requiredDuringSchedulingIgnoredDuringExecution:
18            nodeSelectorTerms:
19              - matchExpressions:
20                  - key: workload
21                    operator: In
22                    values:
23                      - batch
24      containers:
25        - name: app
26          image: nginx:1.27

After updating the workload, trigger rescheduling:

bash
kubectl delete pod my-app-abc123

Because the pod belongs to a controller, Kubernetes creates a replacement that now matches the new scheduling rule.

Understand the Limits of Standalone Pods

If the pod was created directly from a pod manifest and is not owned by a controller, there is no automatic rescheduling. In that case the process is really "delete and recreate," not "move."

For example, you might reapply the manifest with a nodeSelector:

yaml
1apiVersion: v1
2kind: Pod
3metadata:
4  name: utility-pod
5spec:
6  nodeSelector:
7    workload: batch
8  containers:
9    - name: utility
10      image: busybox:1.36
11      command: ["sh", "-c", "sleep 3600"]

Operationally, this is one reason production workloads should usually live behind controllers. Controllers make relocation a rescheduling problem instead of a manual recreation problem.

Check Storage and Disruption Constraints

Not every pod can move freely. Several conditions can block or complicate rescheduling:

  • PodDisruptionBudgets may refuse eviction
  • local storage tied to the node may not be portable
  • strict affinity rules may leave no valid target node
  • the destination node may not have enough CPU or memory

Before draining a node or deleting a critical pod, inspect where the workload can actually go:

bash
kubectl get pods -o wide
kubectl describe pod my-app-abc123
kubectl describe node node-b

Those commands help you confirm ownership, current placement, and target-node capacity before turning a routine move into an outage.

Common Pitfalls

The biggest misconception is expecting live migration like a virtual machine platform might provide. Standard Kubernetes pod movement is rescheduling, not teleporting a running process.

Another mistake is deleting a pod without checking whether a controller owns it. If it is standalone, it disappears and nothing replaces it.

Operators also get stuck when they drain a node and discover that affinity rules, storage constraints, or resource shortages prevent the pod from landing anywhere else.

Finally, do not forget DaemonSets. They are managed differently from ordinary workloads and are intentionally ignored by a basic drain command unless you choose otherwise.

Summary

  • Kubernetes usually relocates pods by evicting and recreating them, not by moving live processes.
  • Use cordon and drain for node maintenance workflows.
  • For a specific destination, encode placement with labels, affinity, taints, or tolerations.
  • Deleting a pod works only when a controller exists to recreate it.
  • Check disruption budgets, storage, and target-node capacity before forcing rescheduling.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.