|
6 | 6 | - Specific Version |
7 | 7 |
|
8 | 8 | ## Step-01: Rollback a Deployment to previous version |
| 9 | + |
| 10 | +### Check the Rollout History of a Deployment |
9 | 11 | ``` |
10 | | -# Check the Rollout History of a Deployment |
| 12 | +# List Deployment Rollout History |
11 | 13 | kubectl rollout history deployment/<Deployment-Name> |
12 | 14 | kubectl rollout history deployment/my-first-deployment |
| 15 | +``` |
13 | 16 |
|
14 | | -# Verify changes in each revision |
| 17 | +### Verify changes in each revision |
| 18 | +- **Observation:** Review the "Annotations" and "Image" tags for clear understanding about changes. |
| 19 | +``` |
| 20 | +# List Deployment History with revision information |
15 | 21 | kubectl rollout history deployment/my-first-deployment --revision=1 |
16 | 22 | kubectl rollout history deployment/my-first-deployment --revision=2 |
17 | 23 | kubectl rollout history deployment/my-first-deployment --revision=3 |
18 | | -Observation: Review the "Annotations" and "Image" tags for clear understanding about changes. |
| 24 | +``` |
19 | 25 |
|
20 | | -# Rollback to previous version |
| 26 | + |
| 27 | +### Rollback to previous version |
| 28 | +- **Observation:** If we rollback, it will go back to revision-2 and its number increases to revision-4 |
| 29 | +``` |
| 30 | +# Undo Deployment |
21 | 31 | kubectl rollout undo deployment/my-first-deployment |
22 | | -kubectl rollout history deployment/my-first-deployment |
23 | | -Observation: If we rollback, it will go back to revision-2 and its number increases to revision-4 |
24 | 32 | |
25 | | -# Access the Application and Test if we are "Application Version: V2" |
26 | | -http://<node1-public-ip>:<Node-Port> |
| 33 | +# List Deployment Rollout History |
| 34 | +kubectl rollout history deployment/my-first-deployment |
| 35 | +``` |
27 | 36 |
|
28 | | -# Verify Deployment, Pods, ReplicaSets |
| 37 | +### Verify Deployment, Pods, ReplicaSets |
| 38 | +``` |
29 | 39 | kubectl get deploy |
30 | 40 | kubectl get rs |
31 | 41 | kubectl get po |
32 | 42 | kubectl describe deploy my-first-deployment |
33 | 43 | ``` |
| 44 | + |
| 45 | +### Access the Application using Public IP |
| 46 | +- We should see `Application Version:V2` whenever we access the application in browser |
| 47 | +``` |
| 48 | +# Get NodePort |
| 49 | +kubectl get svc |
| 50 | +Observation: Make a note of port which starts with 3 (Example: 80:3xxxx/TCP). Capture the port 3xxxx and use it in application URL below. |
| 51 | + |
| 52 | +# Get Public IP of Worker Nodes |
| 53 | +kubectl get nodes -o wide |
| 54 | +Observation: Make a note of "EXTERNAL-IP" if your Kubernetes cluster is setup on AWS EKS. |
| 55 | + |
| 56 | +# Application URL |
| 57 | +http://<worker-node-public-ip>:<Node-Port> |
| 58 | +``` |
| 59 | + |
| 60 | + |
34 | 61 | ## Step-02: Rollback to specific revision |
| 62 | +### Check the Rollout History of a Deployment |
35 | 63 | ``` |
36 | | -# Check the Rollout History of a Deployment |
| 64 | +# List Deployment Rollout History |
37 | 65 | kubectl rollout history deployment/<Deployment-Name> |
38 | 66 | kubectl rollout history deployment/my-first-deployment |
39 | | - |
40 | | -# Rollback to specific revision |
| 67 | +``` |
| 68 | +### Rollback to specific revision |
| 69 | +``` |
| 70 | +# Rollback Deployment to Specific Revision |
41 | 71 | kubectl rollout undo deployment/my-first-deployment --to-revision=3 |
| 72 | +``` |
| 73 | + |
| 74 | +### List Deployment History |
| 75 | +- **Observation:** If we rollback to revision 3, it will go back to revision-3 and its number increases to revision-5 in rollout history |
| 76 | +``` |
| 77 | +# List Deployment Rollout History |
42 | 78 | kubectl rollout history deployment/my-first-deployment |
43 | | -Observation: If we rollback to revision 3, it will go back to revision-3 and its number increases to revision-5 |
| 79 | +``` |
| 80 | + |
| 81 | + |
| 82 | +### Access the Application using Public IP |
| 83 | +- We should see `Application Version:V3` whenever we access the application in browser |
| 84 | +``` |
| 85 | +# Get NodePort |
| 86 | +kubectl get svc |
| 87 | +Observation: Make a note of port which starts with 3 (Example: 80:3xxxx/TCP). Capture the port 3xxxx and use it in application URL below. |
| 88 | + |
| 89 | +# Get Public IP of Worker Nodes |
| 90 | +kubectl get nodes -o wide |
| 91 | +Observation: Make a note of "EXTERNAL-IP" if your Kubernetes cluster is setup on AWS EKS. |
44 | 92 | |
45 | | -# Access the Application and Test if we are "Application Version: V3" |
46 | | -http://<node1-public-ip>:<Node-Port> |
| 93 | +# Application URL |
| 94 | +http://<worker-node-public-ip>:<Node-Port> |
47 | 95 | ``` |
48 | 96 |
|
49 | 97 | ## Step-03: Rolling Restarts of Application |
50 | | -- Rolling restarts will kill the existing pods and recreate new pods. |
| 98 | +- Rolling restarts will kill the existing pods and recreate new pods in a rolling fashion. |
51 | 99 | ``` |
52 | 100 | # Rolling Restarts |
53 | 101 | kubectl rollout restart deployment/<Deployment-Name> |
|
0 commit comments