Articles → DOCKER → Create Deployment Command In Kubernetes

Create Deployment Command In Kubernetes






Purpose





Syntax


kubectl create deploy [deployment_name] --image=[image_name]



Prerequisite




snap install kubectl --classic



Example


Picture showing the execution of kubectl create deploy command



Dry Run




kubectl create deploy [deployment_name] --image=[image_name] --dry-run=client -o yaml


Picture showing the execution of dry run of kubectl create deploy command



Retrieve Deployment Information




kubectl get deployment [deployment_name]


Picture showing the information about the deployment using the kubectl get deployment command




kubectl get deployment [deployment_name] -o yaml


Picture showing the yaml of the deployment



Scaling The Deployment




kubectl scale deploy [deployment_name] --replicas=[desired_replicas]


Picture showing the output of kubectl scale deploy command in docker




Picture showing the replica is changed from 1 to 4



Update The Container Image In Deployment




kubectl set image deploy [deployment_name] [container_image_name]=[updated_image]


Picture showing the output of kubectl set image deploy command for changing the image in docker




Picture showing the image of the container is updated in docker



What Does Replica Mean?





What Is A Selector?





Posted By  -  Karan Gupta
 
Posted On  -  Monday, January 29, 2024
 
Updated On  -  Sunday, February 4, 2024

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250