what is a deployment?
A Kubernetes Deployment is used to tell Kubernetes how to create or modify instances of the pods that hold a containerized application. Deployments can scale the number of replica pods, enable the rollout of updated code in a controlled manner, or roll back to an earlier deployment version if necessary.
How to create a deployment?
you can create a deployment either using a command or using a yaml file.
using a command:
kubectl create deployment my-webdep --image=nginx --replicas=1 --port=80
using yml file:
For that create a folder and inside that create a yml file as deployment.yml and paste the following command in that
replicas: 1 # tells deployment to run 2 pods matching the template
- name: nginx
- containerPort: 80
And run the following command in the terminal
kubectl apply -d deployment.yml
After deploying you have to expose that as a service we can see that in the next story →link
you can check your deployment status using
kubectl get deployments
That’s it for today. I hope you understand everything and thank you for reading.