Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:kubernetes_en:k8s01 [2024/12/27 12:04] – created admin | elearning:workbooks:kubernetes_en:k8s01 [2025/01/17 16:38] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version - **2024.01** | + | Version - **2025.01** |
Last update : ~~LASTMOD~~ | Last update : ~~LASTMOD~~ | ||
- | ======DOE302 - Managing | + | ======DOE302 - Managing |
===== Curriculum===== | ===== Curriculum===== | ||
- | * **DOE302 - Managing | + | * **DOE302 - Managing |
* 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 | + | * 1.2 - Manual |
- | * 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 | + | * 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 | + | * 5.1 - Updating |
- | * 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==== |
- | A 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 | + | A 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 |
- | Conversely, when load is reduced, | + | Conversely, when load is reduced, |
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**. | ||
- | A POD therefore frees the administrator from having to manage Docker **links** and **volumes**. | + | A 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 | + | ====1.2 - Manual |
- | Start by creating a POD called **nginx** from the nginx image: | + | Start by creating a pod called **nginx** from the nginx image: |
< | < | ||
Ligne 63: | Ligne 63: | ||
</ | </ | ||
- | View the POD with the **kubectl** command: | + | View the pod with the **kubectl** command: |
< | < | ||
Ligne 75: | Ligne 75: | ||
</ | </ | ||
- | Consult the information concerning this POD : | + | Consult the information concerning this pod : |
< | < | ||
Ligne 134: | Ligne 134: | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
Ligne 146: | Ligne 146: | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
- | ====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, | + | Kubernetes uses YAML files to create objects. Consequently, |
- | <WRAP todo 60%> | + | < |
To do: Copy the content from **[[https:// | To do: Copy the content from **[[https:// | ||
</ | </ | ||
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: |
< | < | ||
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 | + | 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 |
{{ : | {{ : | ||
- | 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 | + | 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 |
{{ : | {{ : | ||
- | 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: |
{{ : | {{ : | ||
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%> | + | < |
To do: Copy the content from **[[https:// | To do: Copy the content from **[[https:// | ||
</ | </ | ||
Ligne 301: | Ligne 301: | ||
</ | </ | ||
- | This file contains a section called **template**. This section is a template for the creation of additional | + | This file contains a section called **template**. This section is a template for the creation of additional |
< | < | ||
Ligne 318: | Ligne 318: | ||
</ | </ | ||
- | 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: | ||
</ | </ | ||
- | 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: |
< | < | ||
Ligne 347: | Ligne 347: | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
- | Now delete the POD **myapp-pod**: | + | Now delete the pod **myapp-pod**: |
< | < | ||
Ligne 369: | Ligne 369: | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
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%> | + | < |
To do: Copy the content from **[[https:// | To do: Copy the content from **[[https:// | ||
</ | </ | ||
Ligne 455: | Ligne 455: | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
Ligne 473: | Ligne 473: | ||
</ | </ | ||
- | To view the PODs created by ReplicaSet, use the following command: | + | To view the pods created by ReplicaSet, use the following command: |
< | < | ||
Ligne 537: | Ligne 537: | ||
</ | </ | ||
- | View the PODs created by the ReplicaSet : | + | View the pods created by the ReplicaSet : |
< | < | ||
Ligne 566: | Ligne 566: | ||
</ | </ | ||
- | View PODs created by ReplicaSet : | + | View the pods created by ReplicaSet : |
< | < | ||
Ligne 629: | Ligne 629: | ||
</ | </ | ||
- | View the PODs created by the ReplicaSet : | + | View the pods created by the ReplicaSet : |
< | < | ||
Ligne 640: | Ligne 640: | ||
</ | </ | ||
- | Now create a POD outside of the ReplicaSet : | + | Now create a pod outside of the ReplicaSet : |
< | < | ||
Ligne 647: | Ligne 647: | ||
</ | </ | ||
- | View the list of PODs: | + | View the list of pods: |
< | < | ||
Ligne 660: | Ligne 660: | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important**: |
</ | </ | ||
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%> | + | < |
To do: Copy the content from **[[https:// | To do: Copy the content from **[[https:// | ||
</ | </ | ||
Ligne 762: | Ligne 762: | ||
</ | </ | ||
- | 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: |
< | < | ||
Ligne 905: | Ligne 905: | ||
* **Recreate**, | * **Recreate**, | ||
- | * In this case, all existing | + | * In this case, all existing |
* **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**: | + | **Important**: |
</ | </ | ||
- | When updating, Deployment creates another ReplicaSet containing the updated | + | When updating, Deployment creates another ReplicaSet containing the updated |
< | < | ||
Ligne 1044: | Ligne 1044: | ||
</ | </ | ||
- | The **nginx-container** container name is defined in the POD definition file: | + | The **nginx-container** container name is defined in the pod definition file: |
< | < | ||
Ligne 1080: | Ligne 1080: | ||
</ | </ | ||
- | On update, Deployment creates another ReplicaSet containing the updated | + | On update, Deployment creates another ReplicaSet containing the updated |
< | < | ||
Ligne 1216: | Ligne 1216: | ||
</ | </ | ||
- | 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 : |
< | < | ||
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: |
< | < | ||
Ligne 1909: | Ligne 1909: | ||
---- | ---- | ||
- | Copyright © 2024 Hugh Norris | + | Copyright © 2025 Hugh Norris |