TABLE OF CONTENTS
What is Deployment in K8s?
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.
Task-1: Create one Deployment file to deploy an application using "Auto-healing" and "Auto-Scaling" features.
Write the deployment file on the server for the application that is ready for deployment.
Run the deployment file using the kubectl command.
$ kubectl apply -f deployment.yml
Now, check if the deployment is running using below kubectl command.
$ kubectl get deployments
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.
WRITTEN BY Biswaraj Sahoo --AWS Community Builder | DevOps Engineer | Docker | Linux | Jenkins | AWS | Git | Terraform | Docker | kubernetes
Empowering communities via open source and education. Connect with me over linktree: linktr.ee/biswaraj333