Deployment

 Deployment :- 




In a rolling update in Kubernetes, the existing ReplicaSet is not taken down completely before deploying a new one. Instead, the update process is gradual, ensuring minimal downtime and high availability of your application.

Here's how it works:

  1. Create a New ReplicaSet: A new ReplicaSet is created to represent the updated version of the application.

  2. Gradual Scaling: Kubernetes incrementally scales up the new ReplicaSet while simultaneously scaling down the old one. The exact number of pods added or removed during each step is controlled by the maxSurge and maxUnavailable parameters in the update strategy.

    • maxSurge: The maximum number of extra pods that can run above the desired number of replicas during the update.

    • maxUnavailable: The maximum number of pods that can be unavailable during the update.

  3. Progress Monitoring: The process continues until all pods of the old ReplicaSet are replaced by the new ones. If any issues occur, Kubernetes can pause or roll back the update.

This ensures that the deployment is always in a stable and functional state during the transition. Let me know if you'd like more details!


apiVersion: apps/v1

kind: Deployment

metadata:

  name: example-deployment

spec:

  replicas: 3

  strategy:

    type: RollingUpdate

    rollingUpdate:

      maxSurge: 1

      maxUnavailable: 1

  selector:

    matchLabels:

      app: example-app

  template:

    metadata:

      labels:

        app: example-app

    spec:

      containers:

      - name: example-container

        image: nginx:latest


Comments

Popular posts from this blog

Kubernetes - Components

Command Line tools : nerdctl | crictrl | ctr

Service