DevOps(Day-42) : Launching your Kubernetes Cluster with Deployment

 

  • What is Deployment in K8s?

  • Task-1: Create one Deployment file to deploy an application using "Auto-healing" and "Auto-Scaling" features.

In generic terms, Deployment is the method of applying the code builds in the server after successful testing of the code. This will give the entire outcome of how the application works on production. Therefore Deployment of the code needs to happen in a smooth and error-free manner.

In the IT industry, for deployment Kubernetes is used. Using K8s deployments helps you maintain the stability and high availability of your containers. For example, if a node crashes, you’ll want to have a deployment or ReplicaSet in place to replace failed pods. Unless you want to customize the declarative orchestration updates, it’s better to allow deployments to manage your ReplicaSets than it is to manage them directly. Deployment is made up of the following components:

  • YAML file: A YAML file describes the desired state for the Kubernetes cluster.

  • Pods: Pods consist of containers, configurations, and environments to run the applications.

  • ReplicaSet: This is a group of identical pod instances, configured so that the number of running pods always matches the number of pods specified by the YAML file. It ensures that a new pod is created when one fails.

  • kube-scheduler: The kube-scheduler is a component of the control plane, and declares how the pods and ReplicaSets are deployed in the worker nodes.

  • kube-controller-manager: This is another component of the control plane. It watches and modifies the present cluster state to match the desired state defined in the YAML file. It creates, updates, and removes pods and ReplicaSets.

  1. Write the deployment file on the server for the application that is ready for deployment.

  1. Run the deployment file using the kubectl command.

    kubectl apply -f deployment.yml

  2. Now, check if the deployment is running using below kubectl command.

    kubectl get deployments

  3. We have used replicas as 2. This means every time two pods will be running. List the pods.

    kubectl get pods

Thanks for reading my article. Have a nice day.

Comments

Popular posts from this blog

DevOps (Day-1) Introduction

DevOps(Day-3) - File Management in Linux

DevOps(Day-2) Linux