Kubernetes Dry Run Explained: Client and Server Modes

What is Dry Run?

kubectl --dry-run lets you test a command without actually creating/updating resources.

Types of Dry Run

1. Client Side (--dry-run=client)

Use kubectl dry-run for client side validation of a manifest.

  • Runs locally (no cluster call)
  • Just checks syntax
  • Does NOT validate with Kubernetes server
kubectl create deployment my-app --image=nginx --dry-run=client -o yaml
OR
Kubectl apply -f deployment.yaml --dry-run-client

2. Server Side (--dry-run=server)

Use kubectl dry-run for server side validation of a manifest.

  • Sends request to Kubernetes API server
  • Validates:
    • Schema
    • Resource existence
  • but does NOT create anything
kubectl apply -f deployment.yaml --dry-run=server

Verify the deployment with following commands:

kubectl get deployments

Key Difference

FeatureClientServer
Contact cluster❌ No✅ Yes
ValidationBasicFull
Creates resource❌ No❌ No