Changes between Version 1 and Version 2 of k8srollingback2023
- Timestamp:
- Dec 8, 2023, 2:03:44 PM (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
k8srollingback2023
v1 v2 7 7 '''Step 1: Create a Deployment''' 8 8 9 1. Create a Deployment YAML File: myappdeployment2.yaml9 1. Create a Deployment YAML File: `myappdeployment2.yaml` 10 10 11 11 {{{ … … 38 38 '''Step 2: Update the Deployment''' 39 39 40 1. Update the Image: Change the image in your deployment to a new version. For example, update nginx:1.16 to nginx:1.17.40 1. Update the Image: Change the image in your deployment to a new version. For example, update `nginx:1.16` to `nginx:1.17`. 41 41 42 42 2. Apply the Updated Deployment: 43 43 44 `kubectl apply -f deployment.yaml`44 `kubectl apply -f myappdeployment2.yaml` 45 45 46 46 • Monitor the Rollout: … … 62 62 Step 1: Trigger a Faulty Update''' 63 63 64 1. Update the Deployment with a Faulty Image: Change the image to a non-existent or faulty one, like nginx:1.18-faulty.64 1. Update the Deployment with a Faulty Image: Change the image to a non-existent or faulty one, like `nginx:1.18-faulty`. 65 65 66 66 2. Apply the Faulty Deployment: 67 67 68 `kubectl apply -f deployment.yaml`68 `kubectl apply -f myappdeployment2.yaml` 69 69 70 70 ==== Step 2: Rollback the Update ==== … … 72 72 1. Check the Rollout History: 73 73 74 `kubectl rollout history deployment/myapp-deployment `74 `kubectl rollout history deployment/myapp-deployment2` 75 75 76 76 • Rollback to a Previous Revision: Find the revision number you want to rollback to (e.g., 2) and execute: 77 77 78 `kubectl rollout undo deployment/myapp-deployment --to-revision=2`78 `kubectl rollout undo deployment/myapp-deployment2 --to-revision=2` 79 79 80 80 • Verify the Rollback: … … 83 83 84 84 The Pods should be running with the image from the previous stable revision. 85 86 ==== Additional Tips ====87 88 • Automated Rollbacks: Set up readiness and liveness probes in your deployment to automatically rollback if the new version fails to start properly.89 90 • Canary Deployments: For more controlled updates, consider using canary deployments where only a subset of Pods is updated initially.91 92 • Blue/Green Deployments: Another strategy is blue/green deployment, where you deploy a new version alongside the old version and switch traffic once the new version is verified.93 94 By mastering these deployment strategies, you can ensure smooth updates and quick recovery in your Kubernetes environment.95