Search⌘ K
AI Features

Working with Deployments

Explore how to manage Kubernetes deployments using kubectl commands. Learn to create, pause, resume, update, scale, rollback, and delete deployments while monitoring pods and replica sets to maintain application availability.

Some commands related to deployments

The table below contains some of the useful commands for deployment. Try these commands out in the terminal below the table.

Commands

Use

kubectl rollout undo deployment/<depoyment_name>

Rolls back to the previous version of specified deployment

kubectl scale deployment/<deployment_name> --replicas=<number_of_pods>

Scales the number of Pods in the specified deployment

kubectl autoscale deployment/<depolyment_name> --min=10 --max=15 --cpu-percent=80


Auto scales the number of Pods in the specified deployment as per need to a certain maximum and minimum

kubectl rollout pause deployment/<depolyment_name>

Pauses the rollout of deployment

kubectl rollout resume deployment/<depolyment_name>

Resumes the rollout of deployment

Terminal 1
Terminal
Loading...

Observations

In the above terminal:

  • kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml: Creates deployment.
  • kubectl get deployments: Gets list of deployments that include recently created nginx-deployment.
  • kubectl rollout pause deployment/nginx-deployment: The deployment rollout gets paused.
  • kubectl get rs: Here,
...