Rolling Updates And Rolling Back Deployments with NodePort | POD Image Update in Kubernetes

Ticker

6/recent/ticker-posts

Rolling Updates And Rolling Back Deployments with NodePort | POD Image Update in Kubernetes

Question : There is a production deployment planned for next week. The Nautilus DevOps team wants to test the deployment update and rollback on Dev environment first so that they can identify the risks in advance. Below you can find more details about the plan they want to execute.

Create a namespace devops. Create a deployment called httpd-deploy under this new namespace, It should have one container called httpd, use httpd:2.4.28 image and 4 replicas. The deployment should use RollingUpdate strategy with maxSurge=1, and maxUnavailable=2. Also create a NodePort type service named httpd-service and expose the deployment on nodePort: 30008.

Now upgrade the deployment to version httpd:2.4.43 using a rolling update.

Finally, once all pods are updated undo the recent update and roll back to the previous/original version.

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.


 Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. All the Best 👍


Solution:  

1. At first  kubectl  utility configure and working from jump server, rub below commands

    kubectl get namespace 


2.  Create namespace as per the task request.

    kubectl create namespace  devops


3.  Create yaml  file with all the parameters , you can copy form gitlab

    https://gitlab.com/nb-tech-support/devops.git

    Refer Below Video for more clarity )


4.  Run below command to create pod

    kubectl apply  -f  devops.yaml 


5.  Wait for  pods to get running status

        kubectl get pods -n devops

        kubectl get deployment -n devops

        

6.  Perform  rolling update by running below command

 kubectl set image deployment httpd-deploy  httpd=httpd:2.4.43 --namespace devops --record=true



7.  Rollback the deployment as per task  

kubectl rollout undo deployment httpd-deploy  -n devops 


8.  validate roll out status by command


9.  Click on Finish & Confirm to complete the task successful

Happy Learning!!!!

I have made a  tutorial video on this , please go through and share your comments. Like and share the knowledge 



Post a Comment

0 Comments

Latest Posts