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 …


This content originally appeared on DEV Community and was authored by On-cloud7

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.

Task:

Create one Deployment file to deploy a sample todo-app on K8s using "Auto-healing" and "Auto-Scaling" feature

To deploy the sample ToDo app on Kubernetes using Deployment, follow these steps:

Create a YAML file named deployment.yml with the following content:

 apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: todo-app
   labels:
     app: todo
 spec:
   replicas: 2
   selector:
     matchLabels:
       app: todo
   template:
     metadata:
       labels:
         app: todo
     spec:
       containers:
       - name: todo
         image: rishikeshops/todo-app
         ports:
         - containerPort: 3000


2.Apply the deployment to your k8s cluster by running:

 kubectl apply -f deployment.yml

3.Verify that the Deployment is created by running:

 kubectl get deployments

4.Verify that the Pods are running by running:

 kubectl get pods

Conclusion:
In this blog post, we learned how to launch a Kubernetes cluster with Deployment, a configuration that allows us to manage updates to Pods and ReplicaSets. We also deployed a sample ToDo app on Kubernetes using Deployment and enabled auto-healing and auto-scaling for it.


This content originally appeared on DEV Community and was authored by On-cloud7


Print Share Comment Cite Upload Translate Updates
APA

On-cloud7 | Sciencx (2024-08-09T13:08:55+00:00) Day 32 Task: Launching your Kubernetes Cluster with Deployment. Retrieved from https://www.scien.cx/2024/08/09/day-32-task-launching-your-kubernetes-cluster-with-deployment/

MLA
" » Day 32 Task: Launching your Kubernetes Cluster with Deployment." On-cloud7 | Sciencx - Friday August 9, 2024, https://www.scien.cx/2024/08/09/day-32-task-launching-your-kubernetes-cluster-with-deployment/
HARVARD
On-cloud7 | Sciencx Friday August 9, 2024 » Day 32 Task: Launching your Kubernetes Cluster with Deployment., viewed ,<https://www.scien.cx/2024/08/09/day-32-task-launching-your-kubernetes-cluster-with-deployment/>
VANCOUVER
On-cloud7 | Sciencx - » Day 32 Task: Launching your Kubernetes Cluster with Deployment. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/09/day-32-task-launching-your-kubernetes-cluster-with-deployment/
CHICAGO
" » Day 32 Task: Launching your Kubernetes Cluster with Deployment." On-cloud7 | Sciencx - Accessed . https://www.scien.cx/2024/08/09/day-32-task-launching-your-kubernetes-cluster-with-deployment/
IEEE
" » Day 32 Task: Launching your Kubernetes Cluster with Deployment." On-cloud7 | Sciencx [Online]. Available: https://www.scien.cx/2024/08/09/day-32-task-launching-your-kubernetes-cluster-with-deployment/. [Accessed: ]
rf:citation
» Day 32 Task: Launching your Kubernetes Cluster with Deployment | On-cloud7 | Sciencx | https://www.scien.cx/2024/08/09/day-32-task-launching-your-kubernetes-cluster-with-deployment/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.