Day 32 Task: Launching your Kubernetes Cluster with Deployment

Day 32 Task: Launching your Kubernetes Cluster with Deployment

Congratulations on completing Day 31 of your 90daysofdevops challenge! Today, we'll delve deeper into Kubernetes (K8s) by learning about Deployments and practicing launching a Kubernetes Cluster with Deployment.

What is Deployment in Kubernetes?

A Deployment in Kubernetes provides a way to manage and update a set of Pods. It provides a declarative way to define the desired state of your application's Pods and ReplicaSets. The Deployment Controller then works to change the actual state of the Pods to match the desired state defined in the Deployment.

Today's Task: Launching a Kubernetes Cluster with Deployment

Today's task is designed to be simple yet practical. We'll create a Deployment file to deploy a sample todo-app on Kubernetes using "Auto-healing" and "Auto-Scaling" features.

Task 1: Creating a Deployment File

  1. Create a deployment.yml file (a sample is provided below for reference).
  2. Apply the deployment to your Kubernetes (minikube) cluster using the command:

kubectl apply -f deployment.yml        

Sample deployment.yml file:

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
        

Explanation of the Deployment file:

  • apiVersion: The version of the Kubernetes API to use.
  • kind: Specifies the type of resource being created, which is a Deployment in this case.
  • metadata: Contains information like the name and labels of the Deployment.
  • spec: Defines the desired state of the Deployment, including the number of replicas, selector, and template for creating Pods.
  • containers: Specifies the container details, including the name, image, and ports to expose.

Conclusion

By completing this task, you've gained hands-on experience in deploying applications on Kubernetes using Deployments. This is a valuable skill that can enhance your resume and showcase your proficiency in Kubernetes.

Happy Learning!

Utsav Bayaskar

DevOps Engineer at Capgemini

11 个月

Happy Learning!!

回复

要查看或添加评论,请登录

Utsav Bayaskar的更多文章

社区洞察

其他会员也浏览了