Day 32 Task: Launching your Kubernetes Cluster with Deployment

Day 32 Task: Launching your Kubernetes Cluster with Deployment

Day 32: #90DaysOfDevOps Challange

What is Deployment in k8s...!!!

A Deployment provides a configuration for updates for Pods and ReplicaSets.

You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new replicas for scaling, or to remove existing Deployments and adopt all their resources with new Deployments.

Use cases:

How do you update a Kubernetes Deployment?

You can update a Kubernetes deployment by changing the pod template spec within the deployment. That will automatically cause an update rollout.

Changing the Pod template will prevent running pods from accepting requests so they can be scaled back until all pods can be terminated. Once they have been terminated, the updated pod template will be used to create new pods.

How do you scale a Kubernetes Deployment?

Deployments help scale the number of replicas as demand increases for a particular application. Use the kubectl scale command to perform this task. For example, to scale a deployment up to 20 replicas, enter the following into the command line:

Kubectl scale [deployment-name] –replicas 20

Task:

Create one Deployment file to deploy a sample todo-app on K8s using "Auto-healing" and "Auto-Scaling" feature

  • add a deployment.yml file (sample is kept in the folder for your reference)

  • apply the deployment to your k8s (minikube) cluster by command kubectl apply -f deployment.yml

This deployment file will create a deployment with 2 replicas of a container named todo-app. The container is based on the image mattsmanoj/react_django_demo_app, which should be replaced with the actual image name of your application. The container listens on port 3000. The deployment is associated with a label app: todo, which is used in the selector to identify the pods that belong to the deployment.

Apply the deployment to your k8s (minikube) cluster

kubectl apply -f deployment.yaml

To list a deployment:

kubectl get deployments

To list a pods:

here deployment file create a 2 replicas of a container

Thank you for reading!! Hope you find this helpful.

#day32challenge#90daysofdevops

Always open to suggestions..!!

~ Manoj Bhamidipati 🙂