Deployment in k8:-
A Kubernetes Deployment tells Kubernetes how to create or modify instances of the pods that hold a containerised application. Deployments can help to scale the number of replica pods efficiently, enable the rollout of updated code in a controlled manner, or roll back to an earlier deployment version if necessary. Kubernetes deployments are completed using kubectl, the command-line tool that can be installed on various platforms, including Linux, macOS, and Windows.
Benefits of using a Kubernetes Deployment:-
Kubernetes saves time and mitigates errors by automating the work and repetitive manual functions involved in deploying, scaling, and updating applications in production. Since the Kubernetes deployment controller continuously monitors the health of pods and nodes, it can make changes in real time—like replacing a failed pod or bypassing down nodes—to ensure the continuity of critical applications.
Deployments automate the launching of pod instances and ensure they are running as defined across all the nodes in the Kubernetes cluster. More automation translates to faster deployments with fewer errors.
Use cases for Kubernetes Deployments:-
Deployments are the easiest way to manage and scale how applications run on a Kubernetes cluster, and Kubernetes’ open API simplifies integration into CI/CD pipelines.
Here are some common use cases for deployments:
Run stateless web servers, like the popular open-source Nginx. The deployment can request that a fixed number of pod replicas be instantiated, and Kubernetes will maintain that number of pods during the deployment.
Applications that require persistent storage, like a database instance, would use the StatefulSet type deployment and mount a persistent volume to ensure data integrity and longevity.
Deployments can automatically scale the number of replicas in the cluster as the workload increases. For example, they can automatically balance incoming requests between the replicas, create new replicas as demand increases, and terminate replicas as demand subsides.
Difference between JSON and YAML in Kubernetes:-
Both YAML (YAML Ain’t Markup Language) and JSON (JavaScript Object Notation) can be used to define Kubernetes resources. Many users prefer YAML for its readability. However, since YAML is a superset of JSON, any valid JSON file is also a valid YAML file.
Today's 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
Day 32 of #90daysofDevOps
Thanks for reading
Follow me for more about DevOps♾️........
________________________________________________________________________________
#90daysHardChallenge
#Cloudcomputing
#DevOps
#Python
#TrainWithShubham