Changes between Version 1 and Version 2 of k8srollingback2023


Ignore:
Timestamp:
Dec 8, 2023, 2:03:44 PM (5 months ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • k8srollingback2023

    v1 v2  
    77'''Step 1: Create a Deployment'''
    88
    9 1. Create a Deployment YAML File: myappdeployment2.yaml
     91. Create a Deployment YAML File: `myappdeployment2.yaml`
    1010
    1111{{{
     
    3838'''Step 2: Update the Deployment'''
    3939
    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.
     401. Update the Image: Change the image in your deployment to a new version. For example, update `nginx:1.16` to `nginx:1.17`.
    4141
    42422. Apply the Updated Deployment:
    4343
    44 `kubectl apply -f deployment.yaml`
     44`kubectl apply -f myappdeployment2.yaml`
    4545
    4646• Monitor the Rollout:
     
    6262Step 1: Trigger a Faulty Update'''
    6363
    64 1. Update the Deployment with a Faulty Image: Change the image to a non-existent or faulty one, like nginx:1.18-faulty.
     641. Update the Deployment with a Faulty Image: Change the image to a non-existent or faulty one, like `nginx:1.18-faulty`.
    6565
    66662. Apply the Faulty Deployment:
    6767
    68 `kubectl apply -f deployment.yaml`
     68`kubectl apply -f myappdeployment2.yaml`
    6969
    7070==== Step 2: Rollback the Update ====
     
    72721. Check the Rollout History:
    7373
    74 `kubectl rollout history deployment/myapp-deployment`
     74`kubectl rollout history deployment/myapp-deployment2`
    7575
    7676• Rollback to a Previous Revision: Find the revision number you want to rollback to (e.g., 2) and execute:
    7777
    78 `kubectl rollout undo deployment/myapp-deployment --to-revision=2`
     78`kubectl rollout undo deployment/myapp-deployment2 --to-revision=2`
    7979
    8080• Verify the Rollback:
     
    8383
    8484The 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