GithubHelp home page GithubHelp logo

shreyank031 / k8s-rollingupdate-horizontalpodautoscale Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 13 KB

This repository contains a Kubernetes Deployment manifest for deploying an application with rolling update and horizontal pod autoscaller

horizontal-pod-autoscaler k8s-deployment rolling-update

k8s-rollingupdate-horizontalpodautoscale's Introduction

Nginx Deployment with Rolling Update

This repository contains a Kubernetes Deployment manifest for deploying an Nginx web server with a rolling update strategy.

Table of Contents

Overview

The env-deployment.yaml file defines a Kubernetes Deployment resource that deploys four replicas of an Nginx web server. The Deployment uses a rolling update strategy to ensure zero downtime during updates.

Prerequisites

Before deploying the Nginx application, ensure that you have the following prerequisites:

  • A Kubernetes cluster up and running
  • The kubectl command-line tool installed and configured to communicate with the cluster

Deployment

To deploy the Nginx application, follow these steps:

  1. Apply the Deployment manifest:
kubectl apply -f env-deployment.yaml

The above command will create the Deployment resource and spin up four replicas of the Nginx Pods.

  1. Verify that the Deployment and Pods are running:
kubectl get deployment env-deployment
kubectl get pods

You should see the env-deployment Deployment and four Nginx Pods in the running state.

Demo

rolling

Rolling Update

The env-deployment.yaml manifest defines a rolling update strategy for the Deployment. When you update the Deployment, such as changing the Nginx image version or modifying the container configuration, Kubernetes will perform a rolling update without causing any downtime.

Here are the key parameters defined for the rolling update strategy:

  • maxSurge: 1 : Allows one extra Pod to be created during the update process. The new ReplicaSet is created with one extra Pod running updated nginx:1.17 image. The original ReplicaSet will be as it is running 4 pods with nginx:1.16 version. Totally 5 pods with 1 updated image and 4 with old image

    rolling-first-pod

  • maxUnavailable: 0 : Ensures that all Pods are available during the update process. Assume if 3 pods are running out of 4 pods (the desired number of replicas), then k8s won't update. It's typically 4 - 0 = 4 where all the 4 pods should be up and running.

  • minReadySeconds: 10 : Specifies that a new Pod should be ready for at least 10 seconds before considering it available. Then only the one of the pod in original ReplicaSet will be deleted automatically. Suppose if the pod is not running as expected in newly created ReplicaSet, then k8s waits for 10, checks in again waits, doesn't udpate if the pod is not running with new image.

At the end when all the pods are updated in the new ReplicaSet, the last remaining pod inside old/original Replicaset will be terminated

image

Don't forget to see Horizontal Pod Autoscaller here

k8s-rollingupdate-horizontalpodautoscale's People

Contributors

shreyank031 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.