What is Deployment in k8s?
A deployment is an object in Kubernetes that helps you to manage a group of identical pods.
Without a deployment, you’d got to produce, update, and delete a bunch of pods manually.
With a deployment, we tend to declare one object in a very YAML file.
Using Kubernetes deployment we can autoscale the applications very easily.
Task 1: Create one Deployment file to deploy a sample react-django-app on K8s using the "Auto-healing" and "Auto-Scaling" feature
Step 1:- Create a Manifest file named deployment.yml
Step 2:- Now we have to create the deployment using the below command
kubectl apply -f deployment.yml
Step 3:- Now we can verify whether the pods are running or not
kubectl get pods
Step 4:- Now after deleting a pod still get 2 pods as Auto Healing is working, so even though 1 pod is removed or deleted a new pod is replaced with the older one.
Step 5:- Now if we need to delete deployment we can use the below command
kubectl delete -f pod.yml
Note: if we want to scale up and scale down, Can do it using the below command
kubectl scale deployment todo-app --replicas=10
Scaled successfully.
Now delete deployment.yml
kubectl delete -f deployment.yml
Thanks for reading!!!