Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Set Configuration Context

kubectl config use-context rk8s

(Question)

Task

Please complete the following:

  • Create a namespace with name development

  • Create a deployment called prod-deployment with image nginx and tag 1.15.9 within development namesapce, make sure you have 4 replicas for the deployment

  • Set the image to nginx:1.13.6 and check the status of the deployment

  • undo the changes made to the deployment.

Solution - Click to expand!
#Alias k=kubectl
alias k=kubectl

# Create namespace 
k create ns development

# Create deployment
k -n development create deploy prod-deployment --image=nginx:1.15.9 --replicas=4

# Verify the image
k describe deploy -n development | grep -i "image:"

   Output:- Image:        nginx:1.15.9

# Update the image
k set image deploy prod-deployment nginx=nginx:1.13.6 -n development

# Verify the image
k describe deploy -n development | grep -i "image:"
  Output:-  Image:        nginx:1.13.6

# Undo the change made
k rollout undo deploy prod-deployment -n development

# Verify the image after rollback
k describe deploy -n development | grep -i "image:"

   Output:- Image:        nginx:1.15.9