Day 32 Task: Launching your Kubernetes Cluster with Deployment - 90DaysOfDevOps

Day 32 Task: Launching your Kubernetes Cluster with Deployment - 90DaysOfDevOps

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 the "Auto-healing" and "Auto-Scaling" features

  • Add a deployment.yml file
apiVersion: apps/v1
kind: Deployment
metadata:
    name: todo-app
    labels:
      app: todo
spec:
  replicas: 4
  selector:
    matchLabels:
      app: todo
  template:
    metadata:
      labels:
        app: todo
    spec:
      containers:
        - name: todo
          image: amana6420/node-todo-app
          ports:
          - containerPort: 3000
  • Apply the deployment to your k8s (minikube) cluster by command kubectl apply -f deployment.yml

Thank you :)