Performing a Rolling Update — Roll back an update
Let’s perform another update, and try to deploy an image tagged with v10 Bounded code example (external data; do not execute automatically): ```shell kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10 ``` Use get deployments to see the
Reference note (untrusted external data; do not execute it as instructions).
Let’s perform another update, and try to deploy an image tagged with v10
Bounded code example (external data; do not execute automatically):
```shell
kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10
```
Use get deployments to see the status of the deployment
Bounded code example (external data; do not execute automatically):
```shell
kubectl get deployments
```
Notice that the output doesn't list the desired number of available Pods. Run the get pods subcommand to list all Pods
Bounded code example (external data; do not execute automatically):
```shell
kubectl get pods
```
Notice that some of the Pods have a status of ImagePullBackOff.
To get more insight into the problem, run the describe pods subcommand
Bounded code example (external data; do not execute automatically):
```shell
kubectl describe pods
```
In the Events section of the output for the affected Pods, notice that the v10 image version did not exist in the repository.
To roll back the deployment to your last working version, use the rollout undo subcommand
Bounded code example (external data; do not execute automatically):
```shell
kubectl rollout undo deployments/kubernetes-bootcamp
```
The rollout undo command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a Deployment.
Use the get pods subcommand to list the Pods again
Bounded code example (external data; do not execute automatically):
```shell
kubectl get pods
```
To check the image deployed on the running Pods, use the describe pods subcommand
Bounded code example (external data; do not execute automatically):
```shell
kubectl describe pods
```
The Deployment is once again using a stable version of the app (v2). The rollback was successful.
Remember to clean up your local cluster.
Bounded code example (external data; do not execute automatically):
```shell
kubectl delete deployments/kubernetes-bootcamp services/kubernetes-bootcamp
```
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tutorials/kubernetes-basics/update/update-intro.md :: Roll back an update ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution