Skip to content

Commit

Permalink
Welcome to Stack Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalyan Reddy Daida authored and Kalyan Reddy Daida committed Jun 15, 2020
1 parent f4ee013 commit ffb40e2
Showing 1 changed file with 64 additions and 16 deletions.
80 changes: 64 additions & 16 deletions 04-Deployments-with-kubectl/04-03-Rollback-Deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,96 @@
- Specific Version

## Step-01: Rollback a Deployment to previous version

### Check the Rollout History of a Deployment
```
# Check the Rollout History of a Deployment
# List Deployment Rollout History
kubectl rollout history deployment/<Deployment-Name>
kubectl rollout history deployment/my-first-deployment
```

# Verify changes in each revision
### Verify changes in each revision
- **Observation:** Review the "Annotations" and "Image" tags for clear understanding about changes.
```
# List Deployment History with revision information
kubectl rollout history deployment/my-first-deployment --revision=1
kubectl rollout history deployment/my-first-deployment --revision=2
kubectl rollout history deployment/my-first-deployment --revision=3
Observation: Review the "Annotations" and "Image" tags for clear understanding about changes.
```

# Rollback to previous version

### Rollback to previous version
- **Observation:** If we rollback, it will go back to revision-2 and its number increases to revision-4
```
# Undo Deployment
kubectl rollout undo deployment/my-first-deployment
kubectl rollout history deployment/my-first-deployment
Observation: If we rollback, it will go back to revision-2 and its number increases to revision-4
# Access the Application and Test if we are "Application Version: V2"
http://<node1-public-ip>:<Node-Port>
# List Deployment Rollout History
kubectl rollout history deployment/my-first-deployment
```

# Verify Deployment, Pods, ReplicaSets
### Verify Deployment, Pods, ReplicaSets
```
kubectl get deploy
kubectl get rs
kubectl get po
kubectl describe deploy my-first-deployment
```

### Access the Application using Public IP
- We should see `Application Version:V2` whenever we access the application in browser
```
# Get NodePort
kubectl get svc
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.
# Get Public IP of Worker Nodes
kubectl get nodes -o wide
Observation: Make a note of "EXTERNAL-IP" if your Kubernetes cluster is setup on AWS EKS.
# Application URL
http://<worker-node-public-ip>:<Node-Port>
```


## Step-02: Rollback to specific revision
### Check the Rollout History of a Deployment
```
# Check the Rollout History of a Deployment
# List Deployment Rollout History
kubectl rollout history deployment/<Deployment-Name>
kubectl rollout history deployment/my-first-deployment
# Rollback to specific revision
```
### Rollback to specific revision
```
# Rollback Deployment to Specific Revision
kubectl rollout undo deployment/my-first-deployment --to-revision=3
```

### List Deployment History
- **Observation:** If we rollback to revision 3, it will go back to revision-3 and its number increases to revision-5 in rollout history
```
# List Deployment Rollout History
kubectl rollout history deployment/my-first-deployment
Observation: If we rollback to revision 3, it will go back to revision-3 and its number increases to revision-5
```


### Access the Application using Public IP
- We should see `Application Version:V3` whenever we access the application in browser
```
# Get NodePort
kubectl get svc
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.
# Get Public IP of Worker Nodes
kubectl get nodes -o wide
Observation: Make a note of "EXTERNAL-IP" if your Kubernetes cluster is setup on AWS EKS.
# Access the Application and Test if we are "Application Version: V3"
http://<node1-public-ip>:<Node-Port>
# Application URL
http://<worker-node-public-ip>:<Node-Port>
```

## Step-03: Rolling Restarts of Application
- Rolling restarts will kill the existing pods and recreate new pods.
- Rolling restarts will kill the existing pods and recreate new pods in a rolling fashion.
```
# Rolling Restarts
kubectl rollout restart deployment/<Deployment-Name>
Expand Down

0 comments on commit ffb40e2

Please sign in to comment.