Rolling Update - 5 minutes a day to play with Docker container technology (140)

A rolling update is to update only a small number of copies at a time, and after success, update more copies, and finally complete the update of all copies. The biggest benefit of rolling update is zero downtime, and there is always a copy running throughout the update process, thus ensuring business continuity.

Next, we deploy the three-copy application, the initial image is httpd:2.2.31, and then update it to httpd:2.2.32.

The configuration file of httpd:2.2.31 is as follows:

by  kubectl apply deploying.

The deployment process is as follows:

  1. Create Deployment httpd

  2. Create ReplicaSet httpd-551879778

  3. Create three pods

  4. The current image is httpd:2.2.31

httpd:2.2.31 Replace in  the configuration file  with httpd:2.2.32and execute again  kubectl apply.

We found the following changes:

  1. Deployment  httpd 's mirror updated to httpd:2.2.32

  2. A ReplicaSet is newly created  httpd-1276601241, mirrored as  httpd:2.2.32, and three new Pods are managed.

  3. httpd-551879778 There are no Pods in the previous ReplicaSet  .

The conclusion is:  httpd-551879778 the three  Pods of the httpd:2.2.31 ReplicaSet have been replaced  httpd-1276601241 by the three  Pods of the ReplicaSet httpd:2.2.32 .

The specific process can be  kubectl describe deployment httpd viewed through.

Update and replace only one Pod at a time:

  1. The ReplicaSet  httpd-1276601241 adds one Pod to a total of 1.

  2. The ReplicaSet  httpd-551879778 reduces one Pod to a total of 2.

  3. The ReplicaSet  httpd-1276601241 adds one Pod to a total of 2.

  4. The ReplicaSet  httpd-551879778 reduces one Pod to a total of 1.

  5. The ReplicaSet  httpd-1276601241 adds one Pod to a total of 3.

  6. The ReplicaSet  httpd-551879778 reduces one Pod to a total of 0.

The number of Pods replaced per replacement is customizable. Kubernetes provides two parameters  maxSurge and  maxUnavailable to finely control the number of Pod replacements, which we will discuss later in conjunction with the Health Check feature.

In the next section we discuss how to roll back.

Books:
1. "Play with Docker Container Technology in 5 Minutes a Day"
https://item.jd.com/16936307278.html

2. "Fun with OpenStack for 5 minutes a day"
https://item.jd.com/12086376.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324992614&siteId=291194637