1. Deployment Management & Rollout Control
kubectl create deployment <name> --image=<image>What it doesCreates a new Deployment in the current namespace of the specified image
When to use itTo quickly launch a new service for testing without writing a full YAML file
Example
kubectl create deployment nginx-web --image=nginx:alpinekubectl get deployments -n <ns>What it doesDisplays the status of distributions with the number of ready, requested and updated copies
When to use itto check the stability of services and the number of mirrors available
Example
kubectl get deployments -n productionkubectl scale deployment/<name> --replicas=<num> -n <ns>What it doesChange the number of copies of Pods required for the distribution manually and directly
When to use itto handle sudden load spikes or reduce resource consumption in development environments
Example
kubectl scale deployment/api-server --replicas=5 -n productionkubectl set image deployment/<name> <container>=<new-image> -n <ns>What it doesUpdates the container image in the distribution, starting a Rolling Update
When to use itWhen a new software version of the application is released and implemented
Example
kubectl set image deployment/frontend web=frontend:v2.1.0 -n productionkubectl rollout status deployment/<name> -n <ns>What it doesMonitors the progress of the gradual deployment process in real time until all Pods are completed successfully
When to use itIn CI/CD scripts to ensure successful deployment
Example
kubectl rollout status deployment/api-server -n productionkubectl rollout history deployment/<name> -n <ns>What it doesDisplays the history of revisions, previous versions of the distribution, and revision numbers
When to use itTo find out previous modifications and specify the version number you wish to refer to
Example
kubectl rollout history deployment/api-server -n productionkubectl rollout undo deployment/<name> -n <ns>What it doesImmediately roll back the latest update and return the distro to the previous stable version
When to use itWhen a critical bug is detected immediately after deployment to the production environment
Example
kubectl rollout undo deployment/api-server -n productionkubectl rollout restart deployment/<name> -n <ns>What it doesRestarts all distribution pods alternately and without any interruption in service
When to use itTo apply ConfigMap or Secret changes without modifying the application code itself
Example
kubectl rollout restart deployment/worker-queue -n production