Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:kubernetes_en:k8s01 [2024/12/27 12:04] – created adminelearning:workbooks:kubernetes_en:k8s01 [2025/01/17 16:38] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version - **2024.01**+Version - **2025.01**
  
 Last update : ~~LASTMOD~~ Last update : ~~LASTMOD~~
  
-======DOE302 - Managing PODs, Replication Controllers, ReplicaSets, Deployments, Maintenance and Cluster Updates======+======DOE302 - Managing Pods, Replication Controllers, ReplicaSets, Deployments, Maintenance and Cluster Updates======
  
 ===== Curriculum===== ===== Curriculum=====
  
-  * **DOE302 - Managing PODs, Replication Controllers, ReplicaSets, Deployments, Maintenance and Cluster Updates**+  * **DOE302 - Managing Pods, Replication Controllers, ReplicaSets, Deployments, Maintenance and Cluster Updates**
     * Curriculum     * Curriculum
-    * LAB #1 - Creating a POD +    * LAB #1 - Creating a pod 
-      * 1.1 - Introducing a POD +      * 1.1 - Introducing a pod 
-      * 1.2 - Manual POD creation +      * 1.2 - Manual pod creation 
-      * 1.3 - Creating a POD using a YAML file+      * 1.3 - Creating a pod using a YAML file
         * apiVersion         * apiVersion
         * kind         * kind
Ligne 23: Ligne 23:
       * 2.1 - Replication Controllers       * 2.1 - Replication Controllers
         * Overview         * Overview
-        * Application+        * Implementation
       * 2.2 - ReplicaSets       * 2.2 - ReplicaSets
         * Overview         * Overview
-        * Application+        * Implementation
     * LAB #3 - Deployment management     * LAB #3 - Deployment management
       * 3.1 - Overview       * 3.1 - Overview
Ligne 33: Ligne 33:
         * Rolling Updates         * Rolling Updates
         * Rollbacks         * Rollbacks
-    * LAB #4 - Maintenance management+    * LAB #4 - Maintenance
       * 4.1 - The drain command       * 4.1 - The drain command
       * 4.2 - The uncordon command       * 4.2 - The uncordon command
-    * LAB #5 - Update management +    * LAB #5 - Managing Cluster Updates 
-      * 5.1 - Update kubeadm +      * 5.1 - Updating kubeadm 
-      * 5.2 - Worker updates+      * 5.2 - Updating Workers
  
-=====LAB #1 - Creating a POD=====+=====LAB #1 - Creating a pod=====
  
-====1.1 - Introducing a POD====+====1.1 - Introducing a pod====
  
-POD is an object that encapsulates a container. The container is an instance of an application. The relationship between a POD and an application container is generally 1:1, i.e. in the case of an increase in load, additional PODs are created, each containing an application container, rather than creating several containers in the same POD.+pod is an object that encapsulates a container. The container is an instance of an application. The relationship between a pod and an application container is generally 1:1, i.e. in the case of an increase in load, additional pods are created, each containing an application container, rather than creating several containers in the same pod.
  
-Conversely, when load is reduced, PODs are destroyed. With Kubernetes, you can't create multiple containers of the same type in the same POD. However, it is possible to have containers of different types in the same POD.+Conversely, when load is reduced, pods are destroyed. With Kubernetes, you can't create multiple containers of the same type in the same pod. However, it is possible to have containers of different types in the same pod.
  
 In this case, we speak of an application container and one or more **Helper** containers. The application container and the Helper container can communicate directly because they share the same **network space**. They also have access to the same **storage space**. In this case, we speak of an application container and one or more **Helper** containers. The application container and the Helper container can communicate directly because they share the same **network space**. They also have access to the same **storage space**.
  
-POD therefore frees the administrator from having to manage Docker **links** and **volumes**.+pod therefore frees the administrator from having to manage Docker **links** and **volumes**.
  
-When a POD is created with the **kubectl** command, it downloads the Docker image needed to create the container from the Docker Hub.+When a pod is created with the **kubectl** command, it downloads the Docker image needed to create the container from the Docker Hub.
  
-====1.2 - Manual POD creation====+====1.2 - Manual pod creation====
  
-Start by creating a POD called **nginx** from the nginx image:+Start by creating a pod called **nginx** from the nginx image:
  
 <code> <code>
Ligne 63: Ligne 63:
 </code> </code>
  
-View the POD with the **kubectl** command:+View the pod with the **kubectl** command:
  
 <code> <code>
Ligne 75: Ligne 75:
 </code> </code>
  
-Consult the information concerning this POD :+Consult the information concerning this pod :
  
 <code> <code>
Ligne 134: Ligne 134:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that the first line of the **Events** section clearly indicates that in this example, the kubemaster has scheduled the POD on kubenode1.+**Important**: Note that the first line of the **Events** section clearly indicates that in this example, the kubemaster has scheduled the pod on kubenode1.
 </WRAP> </WRAP>
  
Ligne 146: Ligne 146:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that the POD's IP address is **192.168.239.1**. This address is **dynamic**. If the POD stops and another one starts, the IP address of the new POD will be different.+**Important**: Note that the pod's IP address is **192.168.239.1**. This address is **dynamic**. If the pod stops and another one starts, the IP address of the new pod will be different.
 </WRAP> </WRAP>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that the **NOMINATED NODE** column is marked **<none>**. This is because it's possible to assign a POD to a specific node by using a label defined for the nominated node(s). For more information, go to **[[https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/]]**.+**Important**: Note that the **NOMINATED NODE** column is marked **<none>**. This is because it's possible to assign a pod to a specific node by using a label defined for the nominated node(s). For more information, go to **[[https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/]]**.
 </WRAP> </WRAP>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that in the **READINESS GATES** column it says **<none>**. In fact, it is possible to assign specific conditions to a POD so that Kubenetes considers the POD to be in a **ready** state. For more information, visit the **[[https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate]]** link.+**Important**: Note that in the **READINESS GATES** column it says **<none>**. In fact, it is possible to assign specific conditions to a pod so that Kubenetes considers the pod to be in a **ready** state. For more information, visit the **[[https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate]]** link.
 </WRAP> </WRAP>
  
-====1.3 - Creating a POD using a YAML file====+====1.3 - Creating a pod using a YAML file====
  
-Kubernetes uses YAML files to create objects. Consequently, the definition of the POD to be created is described in a YAML file. Create the file **pod-definition.yaml** :+Kubernetes uses YAML files to create objects. Consequently, the definition of the pod to be created is described in a YAML file. Create the file **pod-definition.yaml** :
  
-<WRAP todo 60%>+<WRAP center round todo 60%>
 To do: Copy the content from **[[https://www.dropbox.com/scl/fi/n8iwjrfich5af7vtoezac/pod-definition.yaml?rlkey=hs3nwcczi1zucs3l7cge3bc9s&dl=0|here]] and paste it into your file.** To do: Copy the content from **[[https://www.dropbox.com/scl/fi/n8iwjrfich5af7vtoezac/pod-definition.yaml?rlkey=hs3nwcczi1zucs3l7cge3bc9s&dl=0|here]] and paste it into your file.**
 </WRAP> </WRAP>
Ligne 236: Ligne 236:
 ===Using the YAML file=== ===Using the YAML file===
  
-Now use the YAML file to create a POD :+Now use the YAML file to create a pod:
  
 <code> <code>
Ligne 254: Ligne 254:
 ====2.1 - Replication Controllers==== ====2.1 - Replication Controllers====
  
-===Introduction to Replication Controllers===+===Overview===
  
-A Replication Controller allows multiple instances of the same POD to be run, providing **high availability** in the event of an application crash and POD failure. Even if there is only one POD, the Replication Controller can automatically start another POD containing the application:+A Replication Controller allows multiple instances of the same pod to be run, providing **high availability** in the event of an application crash and pod failure. Even if there is only one pod, the Replication Controller can automatically start another pod containing the application:
  
 {{ :elearning:workbooks:debian:6:avance:kubernetes07.png?direct&600 |}} {{ :elearning:workbooks:debian:6:avance:kubernetes07.png?direct&600 |}}
  
-A Replication Controller can also be used to start new PODs in the event of an increase in the load, as well as to ensure load balancing between PODs:+A Replication Controller can also be used to start new pods in the event of an increase in the load, as well as to ensure load balancing between pods:
  
 {{ :elearning:workbooks:debian:6:avance:kubernetes08.png?direct&600 |}} {{ :elearning:workbooks:debian:6:avance:kubernetes08.png?direct&600 |}}
  
-In the event that the first node runs out of resources, a Replication Controller is able to start new PODs on a second node:+In the event that the first node runs out of resources, a Replication Controller is able to start new pods on a second node:
  
 {{ :elearning:workbooks:debian:6:avance:kubernetes09.png?direct&600 |}} {{ :elearning:workbooks:debian:6:avance:kubernetes09.png?direct&600 |}}
Ligne 272: Ligne 272:
 To create a Replication Controller, you need to create a YAML file. Create the file **cr-definition.yaml** : To create a Replication Controller, you need to create a YAML file. Create the file **cr-definition.yaml** :
  
-<WRAP todo 60%>+<WRAP center round todo 60%>
 To do: Copy the content from **[[https://www.dropbox.com/scl/fi/2atlsvs2oi21fp6xudh46/cr_definition.yaml?rlkey=35lzzkg6qah55pjw34ccaval7&dl=0|here]] and paste it into your file.** To do: Copy the content from **[[https://www.dropbox.com/scl/fi/2atlsvs2oi21fp6xudh46/cr_definition.yaml?rlkey=35lzzkg6qah55pjw34ccaval7&dl=0|here]] and paste it into your file.**
 </WRAP> </WRAP>
Ligne 301: Ligne 301:
 </code> </code>
  
-This file contains a section called **template**. This section is a template for the creation of additional PODs and is identical to the contents of the **pod-definition.yaml** file without the apiVersion and kind fields:+This file contains a section called **template**. This section is a template for the creation of additional pods and is identical to the contents of the **pod-definition.yaml** file without the apiVersion and kind fields:
  
 <code> <code>
Ligne 318: Ligne 318:
 </code> </code>
  
-The **replicas** field indicates the number of PODs to be created.+The **replicas** field indicates the number of pods to be created.
  
 Use the rc-definition.yaml file to create the Replication Controller: Use the rc-definition.yaml file to create the Replication Controller:
Ligne 335: Ligne 335:
 </code> </code>
  
-To view the PODs created by the Replication Controller, use the following command:+To view the pods created by the Replication Controller, use the following command:
  
 <code> <code>
Ligne 347: Ligne 347:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that the Replication Controller has created two replicas **myapp-cr-6gxg6** and **myapp-cr-78frz** because the first already existed: **myapp-pod**. To identify an existing POD of the same type, the Replication Controller relies on the **labels** field in the **template** section.+**Important**: Note that the Replication Controller has created two replicas **myapp-cr-6gxg6** and **myapp-cr-78frz** because the first already existed: **myapp-pod**. To identify an existing pod of the same type, the Replication Controller relies on the **labels** field in the **template** section.
 </WRAP> </WRAP>
  
-Now delete the POD **myapp-pod**:+Now delete the pod **myapp-pod**:
  
 <code> <code>
Ligne 369: Ligne 369:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that the Replication Controller has created the **myapp-cr-pt4zt** POD.+**Important**: Note that the Replication Controller has created the **myapp-cr-pt4zt** pod.
 </WRAP> </WRAP>
  
Ligne 412: Ligne 412:
 ====2.2 - ReplicaSets==== ====2.2 - ReplicaSets====
  
-===Presentation of a ReplicaSet===+===Overview===
  
 A ReplicaSet performs the same function as a Replication Controller. ReplicaSets are the latest way to manage replication. A ReplicaSet performs the same function as a Replication Controller. ReplicaSets are the latest way to manage replication.
Ligne 420: Ligne 420:
 To create a ReplicaSet, create the file **replicaset-definition.yaml** : To create a ReplicaSet, create the file **replicaset-definition.yaml** :
  
-<WRAP todo 60%>+<WRAP center round todo 60%>
 To do: Copy the content from **[[https://www.dropbox.com/scl/fi/j8ww8mdm82cec71lnz023/replicaset-definition.yaml?rlkey=2iypd89690ipt6lik3h3bae3f&dl=0|here]] and paste it into your file.** To do: Copy the content from **[[https://www.dropbox.com/scl/fi/j8ww8mdm82cec71lnz023/replicaset-definition.yaml?rlkey=2iypd89690ipt6lik3h3bae3f&dl=0|here]] and paste it into your file.**
 </WRAP> </WRAP>
Ligne 455: Ligne 455:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that in the case of a ReplicaSet, it identifies the PODs under its control by the value of the **matchLabels** field.+**Important**: Note that in the case of a ReplicaSet, it identifies the pods under its control by the value of the **matchLabels** field.
 </WRAP> </WRAP>
  
Ligne 473: Ligne 473:
 </code> </code>
  
-To view the PODs created by ReplicaSet, use the following command:+To view the pods created by ReplicaSet, use the following command:
  
 <code> <code>
Ligne 537: Ligne 537:
 </code> </code>
  
-View the PODs created by the ReplicaSet :+View the pods created by the ReplicaSet :
  
 <code> <code>
Ligne 566: Ligne 566:
 </code> </code>
  
-View PODs created by ReplicaSet :+View the pods created by ReplicaSet :
  
 <code> <code>
Ligne 629: Ligne 629:
 </code> </code>
  
-View the PODs created by the ReplicaSet :+View the pods created by the ReplicaSet :
  
 <code> <code>
Ligne 640: Ligne 640:
 </code> </code>
  
-Now create a POD outside of the ReplicaSet :+Now create a pod outside of the ReplicaSet :
  
 <code> <code>
Ligne 647: Ligne 647:
 </code> </code>
  
-View the list of PODs:+View the list of pods:
  
 <code> <code>
Ligne 660: Ligne 660:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that **myapp-pod** is in a **Terminating** state. ReplicaSet does not allow the creation of a POD with the same label as specified by the **matchLabels** field in **replicaset-definition.yaml**.+**Important**: Note that **myapp-pod** is in a **Terminating** state. ReplicaSet does not allow the creation of a pod with the same label as specified by the **matchLabels** field in **replicaset-definition.yaml**.
 </WRAP> </WRAP>
  
Ligne 701: Ligne 701:
 To create a Deployment, you need to create a YAML file. Create the file **deployment-definition.yaml** : To create a Deployment, you need to create a YAML file. Create the file **deployment-definition.yaml** :
  
-<WRAP todo 60%>+<WRAP center round todo 60%>
 To do: Copy the content from **[[https://www.dropbox.com/scl/fi/h057eynmqvlaoytph372r/deployment-definition.yaml?rlkey=lrs8llq89ffn1a5megm317f5y&dl=0|here]] and paste it into your file.** To do: Copy the content from **[[https://www.dropbox.com/scl/fi/h057eynmqvlaoytph372r/deployment-definition.yaml?rlkey=lrs8llq89ffn1a5megm317f5y&dl=0|here]] and paste it into your file.**
 </WRAP> </WRAP>
Ligne 762: Ligne 762:
 </WRAP> </WRAP>
  
-The creation of the Deployment created the number of PODs indicated in the YAML file:+The creation of the Deployment created the number of pods indicated in the YAML file:
  
 <code> <code>
Ligne 905: Ligne 905:
  
   * **Recreate**,   * **Recreate**,
-    * In this case, all existing PODs are destroyed at the same time, and PODs containing the update are created at a later stage. The disadvantage of this method is obvious - between the destruction of the PODs and the re-creation of the new PODs, the application is not available,+    * In this case, all existing pods are destroyed at the same time, and pods containing the update are created at a later stage. The disadvantage of this method is obvious - between the destruction of the pods and the re-creation of the new pods, the application is not available,
   * **Rolling Update**   * **Rolling Update**
-    * In this case, PODs are destroyed one by one. After each deletion, a new POD is created containing the update. In this way, the application remains available.+    * In this case, pods are destroyed one by one. After each deletion, a new pod is created containing the update. In this way, the application remains available.
  
 <WRAP center round important 60%> <WRAP center round important 60%>
Ligne 1020: Ligne 1020:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: Note that the image used is indeed **nginx:1.12**. Then note that in the **Events** section, the PODs have been **Scaled down** one-by-one and **Scaled up** one-by-one. Also note that the value of **StrategyType** can be either **Recreate** or **RollingUpdate**. Finally, note the value of **RollingUpdateStrategy**. **25% max unavailable** indicates that at time “t” 75% of all PODs must be available, while **25% max surge** indicates that the total number of PODs cannot exceed 1.25 times the value of the **Replicas** field. These values can be modified. See page **[[https://kubernetes.io/docs/concepts/workloads/controllers/deployment/]]**.+**Important**: Note that the image used is indeed **nginx:1.12**. Then note that in the **Events** section, the pods have been **Scaled down** one-by-one and **Scaled up** one-by-one. Also note that the value of **StrategyType** can be either **Recreate** or **RollingUpdate**. Finally, note the value of **RollingUpdateStrategy**. **25% max unavailable** indicates that at time “t” 75% of all pods must be available, while **25% max surge** indicates that the total number of pods cannot exceed 1.25 times the value of the **Replicas** field. These values can be modified. See page **[[https://kubernetes.io/docs/concepts/workloads/controllers/deployment/]]**.
 </WRAP> </WRAP>
  
-When updating, Deployment creates another ReplicaSet containing the updated PODs, using the Rolling Update method. This can be seen by looking at the output of the **kubectl get replicasets** command:+When updating, Deployment creates another ReplicaSet containing the updated pods, using the Rolling Update method. This can be seen by looking at the output of the **kubectl get replicasets** command:
  
 <code> <code>
Ligne 1044: Ligne 1044:
 </code> </code>
  
-The **nginx-container** container name is defined in the POD definition file:+The **nginx-container** container name is defined in the pod definition file:
  
 <code> <code>
Ligne 1080: Ligne 1080:
 </code> </code>
  
-On update, Deployment creates another ReplicaSet containing the updated PODs using the Rolling Update method. This can be seen by looking at the output of the **kubectl get replicasets** command:+On update, Deployment creates another ReplicaSet containing the updated pods using the Rolling Update method. This can be seen by looking at the output of the **kubectl get replicasets** command:
  
 <code> <code>
Ligne 1216: Ligne 1216:
 </code> </code>
  
-The **kubectl get pods** command shows a status of **ImagePullBackOff** for the first POD in the new ReplicaSet which indicates that Kubernetes cannot perform the **pull** of the image from Docker Hub :+The **kubectl get pods** command shows a status of **ImagePullBackOff** for the first pod in the new ReplicaSet which indicates that Kubernetes cannot perform the **pull** of the image from Docker Hub :
  
 <code> <code>
Ligne 1270: Ligne 1270:
 ====4.1 - The drain command==== ====4.1 - The drain command====
  
-Check the status of all the PODs:+Check the status of all the pods:
  
 <code> <code>
Ligne 1909: Ligne 1909:
  
 ---- ----
-Copyright © 2024 Hugh Norris+Copyright © 2025 Hugh Norris
Menu