Skip to main content

Command Palette

Search for a command to run...

πŸš€πŸ“… Day 58 DevOps Challenge - πŸš€ Launching your Kubernetes Cluster with Deployment

Updated
β€’3 min read
πŸš€πŸ“… Day 58 DevOps Challenge - πŸš€ Launching your Kubernetes Cluster with Deployment
A

Passionate software engineering student | DevOps enthusiast | Seeking innovation and excellence in software engineering! πŸ‘¨β€πŸ’»

In the exciting world of Kubernetes (K8s), one of the fundamental concepts you'll encounter is Deployment. πŸ› οΈ But what exactly is a Deployment in K8s?

Kubernetes Deployment Tutorial For Beginners

Understanding Deployment in K8s

A Deployment in Kubernetes provides a robust configuration for managing updates for Pods and ReplicaSets. It allows you to define a desired state, and the Deployment Controller ensures that the actual state of your application aligns with this desired state at a controlled pace. This controlled rate of change helps in maintaining stability during updates and scaling.

07751442 deployment

You can use Deployments to achieve various objectives, such as creating new replicas for scaling your application or replacing existing Deployments and adopting all their resources with new ones. The flexibility of Deployments is a powerful tool in managing your applications effectively. πŸ”§

Today's Task

Today, let's keep it simple yet impactful with a specific task.

For performing these tasks, ensure that you have Kubernetes/minikube installed on your local machine. Alternatively, you can use a cloud-based virtual machine such as an EC2 instance. If you haven't set up Kubernetes/minikube yet, you can refer to my previous blog πŸ“–: Install Minikube on your local machine or AWS EC2 instance πŸŒŸπŸ› οΈ

Task-1: Create a Sample Deployment with "Auto-healing" and "Auto-Scaling" Features

Your mission is to create a Deployment file that deploys a sample nginx on your Kubernetes cluster using the "Auto-healing" and "Auto-Scaling" features.

Steps to Accomplish the Task:

  1. Create a Deployment File: On your EC2 instance where you've set up minikube, you'll need to create a file named deployment.yaml. This file will define the desired state of your cluster.

    Below is the sample deployment configuration. You can copy this and paste it into your deployment.yaml file.

     apiVersion: apps/v1
     kind: Deployment
     metadata:
       name: nginx-deployment
       labels:
         app: nginx
     spec:
       replicas: 3
       selector:
         matchLabels:
           app: nginx
       template:
         metadata:
           labels:
             app: nginx
         spec:
           containers:
           - name: nginx
             image: nginx:1.14.2
             ports:
             - containerPort: 80
    

    Note: Don't worry about memorizing every detail of the file configuration (e.g., pod.yml or deployment.yml). You can simply refer to provided examples and modify them according to your specific needs.

  2. Apply the Deployment: Use the kubectl apply command to apply the Deployment configuration to your K8s (minikube) cluster. The command will look like this:

     kubectl apply -f deployment.yaml
    

This simple yet impactful task will not only enhance your understanding of Deployments but also add another valuable project to your resume. Let's get coding and make your resume shine! 🌟

Closing Thoughts

Thanks for reading my learning journey! I appreciate your time and dedication. If you find any mistakes or have any feedback, feel free to drop a comment. Your engagement means a lot! 😊 Don't forget to like and share this content to spread the knowledge. Let's connect on social media:

Happy learning and coding! Keep exploring the fascinating world of Kubernetes and beyond. πŸ’‘

More from this blog

Adarsh Jha

65 posts