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.

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.

Prerequisites:

1) Create a folder name kubernetes-basic.

2) sudo nano deployment.yaml.

3 Enter code in yaml file then save with the help of CTRL+S. (for code copy you can direct visit the kuberentes offical website link:-kubernetes.io/docs/concepts/workloads/contr..

Syntax:-

No alt text provided for this image

Deployment.yaml file Diagram.

No alt text provided for this image

create a directory & enter code and check with the help of cat commands Diagram.

This deployment file will create a deployment with 2 replicas of a container named todo. The container is based on the image maninder/ddjango-todo-app:latest, Which should be replaced with the actual image application. The Container listens on port 800. 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.

Install the Kubectl in your system I will give you the following commands and links for install, It will help you:-(Link matthewpalmer.net/kubernetes-app-developer/..).

No alt text provided for this image

Instal the Kubectl Setup on Ec2 Machine and Link in the below Diagram.

Syntax:- kubectl apply -f deployment.yaml

No alt text provided for this image

kubectl apply -f deployment.yaml Diagram.

Your Kubectl apply -f deployment.yaml successfully run in the above Diagram.

To list a deployment:

Syntax:- kubectl get deployments

No alt text provided for this image

kubectl get deployments Diagram.

To list a pods:

here deployment file create a 2 replicas of a container.

Syntax:-kubectl get pods

No alt text provided for this image

kubectl get pods Diagram.

Brief Notes:- At the end i will share common links for the following setup's. It will help you for the Today's Article.

Kubectl Downloads Link and how to install and version check:-

matthewpalmer.net/kubernetes-app-developer/..

Kubernetes file Syntax with code i will use these Link:-

Thank you for reading!! I hope you find this article helpful!!

Happy Learning!!