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:- I have already a docker image in the docker hub for a sample todo- app. Now we need to pull the the image from docker hub by running the below command
sudo docker pull poojavibhute/react_django_app:latest
Step 2:- Then create a Manifest file named pod.yml where all the configuration related to the image will store.
Step 3:- Now we have to create the deployment using the below command
kubectl apply -f pod.yml
Step 4:- Now we can verify whether the pods are running or not by following the below command.
kubectl get pods
Step 5:- 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 6:- 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 react-django-app --replicas=10