Launching your Kubernetes Cluster with Deployment

Launching your Kubernetes Cluster with Deployment

What is Deployment in k8s?

A Kubernetes Deployment is an API resource that provides a declarative way to define the desired state of an application. It allows you to describe the application's components, the number of instances (replicas) to run, and how updates or rollbacks should be handled.

Deployment in Kubernetes (k8s) is a higher-level concept that helps manage pods and replicas. It ensures that a specified number of pod "replicas" are running at any given time.

A Deployment in Kubernetes:

  • Specifies the desired state of the system (i.e., how many replicas should be running)
  • Manages the pod creation, updates, and deletion
  • Handles scaling (adding or removing replicas)
  • Rolls back to a previous version in case of failure
  • Supports updating pods and their replicas without any downtime (i.e., zero-downtime deployments)

Features of a Kubernetes Deployment

  1. Declarative Configuration: You specify the desired state of your application, and Kubernetes takes care of achieving and maintaining that state.
  2. Rolling Updates and Rollbacks: Deployments enable you to update your application without downtime by gradually replacing instances with new ones. If an update fails or you need to roll back to a previous version, Kubernetes can easily revert to the previous state.
  3. Scaling: Deployments allow you to scale your application horizontally by adjusting the number of replicas, distributing the load across multiple instances.

Self-healing: If a pod (an instance of a running container) within a deployment fails, Kubernetes automatically replaces it to maintain the desired number of replicas.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: example-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: example
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
      - name: example-container
        image: example-image:tag
        

  • replicas: 3 specifies that there should be three instances (pods) of the application.
  • selector is used to match pods with the labels specified in the template.
  • The template section defines the pod template, including the container image to be used.

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

Daniel Gurus的更多文章

  • Why prefer Kubernetes ?

    Why prefer Kubernetes ?

    Kubernetes has become a cornerstone in modern container orchestration and management for a variety of reasons. Its…

    3 条评论
  • AWS EC2 Automation

    AWS EC2 Automation

    Instance Types General Purpose Instances (e.g.

  • AWS and IAM Basics

    AWS and IAM Basics

    AWS Identity and Access Management (IAM) is a web service provided by Amazon Web Services (AWS) that enables you to…

    2 条评论
  • Managing Persistent Volumes in Your Deployment

    Managing Persistent Volumes in Your Deployment

    What are Persistent Volumes in k8s In Kubernetes (k8s), a Persistent Volume (PV) is a cluster-wide piece of storage in…

  • Mastering ConfigMaps and Secrets in Kubernetes

    Mastering ConfigMaps and Secrets in Kubernetes

    What are ConfigMaps and Secrets in k8s ConfigMaps: ConfigMaps are Kubernetes resources that allow you to decouple…

  • Mastering Docker Best Practices: A DevOps Engineer's Guide

    Mastering Docker Best Practices: A DevOps Engineer's Guide

    Introduction: In the ever-evolving landscape of software development and deployment, Docker has emerged as a…

  • Devops Best Practices for Seamless Integration

    Devops Best Practices for Seamless Integration

    Introduction: In today's fast-paced tech world, the need for efficient collaboration between development and operations…

    1 条评论
  • Working with Services in Kubernetes

    Working with Services in Kubernetes

    What are Services in K8s In Kubernetes (K8s), a service is an abstraction that defines a logical set of pods and a…

  • Working with Namespaces and Services in Kubernetes

    Working with Namespaces and Services in Kubernetes

    What are Namespaces and Services in k8s A Namespace in Kubernetes is a way to partition cluster resources. It allows…

  • Basic networking concepts for Devops engineer

    Basic networking concepts for Devops engineer

    Here are some fundamental networking concepts that are important for a DevOps engineer: IP Addressing: IPv4 and IPv6:…

    3 条评论

社区洞察

其他会员也浏览了