Day 32 Task: Launching your Kubernetes Cluster with Deployment

Day 32 Task: Launching your Kubernetes Cluster with Deployment

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

Today's task let's keep it very simple..!!!

Task-1:

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

Autoscaling is one of the key features in Kubernetes cluster. It is a feature in which the cluster is capable of increasing the number of nodes as the demand for service response increases and decrease the number of nodes as the requirement decreases.

Scaled as 4

Increasing number of replicas.we can say it as autoscaling depends on workload we can scale up/scale down accordingly.

The idea behind self-healing Kubernetes is simple: If a container fails, Kubernetes automatically redeploys the afflicted container to its desired state to restore operations.

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

#day32#90daysofdevops#devopscommunity#

Always open for suggestions..!!

Thank you Shubham Londhe !!