#90DaysOfDevOps Challenge - Day 32 - Launching your Kubernetes Cluster with Deployment

Cloud Engineer and DevOps enthusiast, just talking about AWS, Docker, Linux, Kubernetes, Python, and automation.
Search for a command to run...

Cloud Engineer and DevOps enthusiast, just talking about AWS, Docker, Linux, Kubernetes, Python, and automation.
No comments yet. Be the first to comment.
The #90DaysOfDevOps Challenge is a dedicated initiative aimed at promoting continuous learning and skill development in the field of DevOps over a 90-day period.
Running your own home lab used to mean expensive hardware, complex networking, and hours of manual configuration. This project changes that. With a single Raspberry Pi, Docker Compose, and a few hundr

Welcome to an advanced hybrid directory demo where we'll guide you through setting up a hybrid environment, connecting to simulated on-premises infrastructure, creating a managed Microsoft AD within AWS, establishing a two-way forest trust, and integ...

Hello DevOps Community! Today marks the completion of the #90DaysOfDevOps Challenge, and it's a moment to reflect on the journey we've undertaken together. Throughout this period, I've engaged with various technologies, refining my skills in the DevO...

In a modern cloud infrastructure setup, creating a robust and scalable 2-tier architecture is essential. Such an architecture helps meet the demands of your applications while ensuring repeatability, reliability, and security. In this article, we'll ...

Welcome to Part 4 of my series on building a comprehensive CI/CD pipeline in AWS. In this article, I will explore AWS CodePipeline, a powerful service for building and deploying applications in a continuous integration and continuous delivery (CI/CD)...

Welcome to Day 32 of the #90DaysOfDevOps challenge. After successfully launching our Kubernetes cluster with Minikube on the previous day, today we will dive deeper into Kubernetes deployments. So let's get started.

In Kubernetes, a Deployment is an object that provides declarative updates to manage application deployments. It defines the desired state of the application and handles the creation, scaling, and updating of the application's replicas. Deployments are a key component of managing containerized applications in a Kubernetes cluster.
A Deployment ensures that the desired number of replicas of an application is running and manages the lifecycle of those replicas. It allows for rolling updates, rollback to previous versions, and scaling of the application replicas based on the defined configuration.
Deployments are often used to manage stateless applications, where each instance of the application is independent of others. They are particularly useful in scenarios where high availability, fault tolerance, and easy scaling are required.
Using Deployments in Kubernetes offers several benefits:
Ease of Management: Deployments provide a declarative way to define and manage the state of applications. You can specify the desired state of your application, and Kubernetes takes care of creating, updating, and scaling the replicas to match that state.
Rolling Updates and Rollbacks: Deployments support rolling updates, allowing you to update your application gradually without downtime. If an update introduces issues, you can easily roll back to a previous version of the application.
Scalability: Deployments enable easy scaling of your application by simply adjusting the number of replicas. This allows you to handle increased traffic or load by adding more instances of the application.
High Availability: Deployments ensure that the desired number of replicas are always running. If a replica fails, Kubernetes automatically replaces it to maintain the desired state and ensure high availability.
Self-Healing: Kubernetes continuously monitors the health of application replicas managed by a Deployment. If a replica becomes unhealthy or fails, Kubernetes automatically replaces it with a new one, ensuring the overall health of the application.
1 - Create a file called deployment.yml and define the deployment configuration.
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: estebanmorenoit/my-web-app
ports:
- containerPort: 3000
2 - Use the following command to apply the deployment to your Minikube cluster:
kubectl apply -f deployment.yml
This command will read the deployment configuration from the file and create the necessary resources on your Kubernetes cluster. Wait for the deployment to be successfully applied.

3 - To verify that the deployment is running correctly, use the following command to get the status of the deployment:
kubectl get deployments
This will display a list of deployments in your cluster, including the one you just applied. Ensure that the desired number of replicas is available and that the deployment has been successfully created.

4 - Check the status of the pods created by the deployment using the following command:
kubectl get pods
You should see the pods associated with your deployment. Ensure that they are in the "Running" state.

Congratulations on successfully launching your Kubernetes cluster using Minikube and deploying a sample todo-app with auto-healing and auto-scaling features. By gaining hands-on experience with deployments, you have taken a significant step forward in your journey to master Kubernetes. Day 33 of the #90DaysOfDevOps challenge will build upon this foundation as we dive deeper into Kubernetes Namespaces and Services. Stay tuned!