Rolling Updates and Rollbacks in Deployments - Sandeep-K-Khandelwal/CKAD GitHub Wiki

  • Create a deployment - kubectl create -f deployment-definition.yml
  • List the deployments -kubectl get deployments
  • Update the deployment -
    • kubectl apply -f deployment-definition.yml
    • kubectl set image <deployment_name> <container_name>=<newer_image_name>
    • kubectl edit deployment <deployment_name>
    • Use the --record field to record the command in the revision history used to update the deployment
  • Status of the deployment
    • kubectl rollout status deployment <deployment_name>
    • kubectl rollout history deployment <deployment_name>
  • Rollback of the deployment
    • kubectl rollout undo deployment <deployment_name>