Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand Deployment

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to understand Deployment. Many people may not know much about it. In order to let you know more, Xiaobian summarizes the following contents for you. I hope you can gain something according to this article.

Deployment is a higher-level controller introduced after ReplicationController and ReplicaSet. It declares the expected state of the Pod through the Deployment object. These states include the number of replicas of the Pod and the template of the Pod. The Deployment Controller (Deployment Controller) running in the kube-controller-manager component constantly monitors the changes of the Deployment object and adjusts the Pod according to the configuration in the Deployment object to ensure that the Pod runs in the expected form.

configuration format

Let's start with a simple Deployment configuration:

apiVersion: apps/v1kind: Deploymentmetadata: name: nginx-deployment labels: app: nginxspec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.19.0

metadata.name: Specifies the name of the Deployment;

spec.replicas: Specifies the desired number of replicas;

spec.selector: Specifies the label to find the Pod;

spec.template: Specifies the template of the Pod from which the Deployment Controller creates pods when it needs to.

The Deployment configuration above is very similar to ReplicaSet described earlier, mainly declaring the number of Pod replicas and Pod templates. After submitting the configuration to kube-apiserver, Deployment Controller running in kube-controller-manager component will also create 3 Pod replicas. This behavior is the same as ReplicaSet, but Deployment's more powerful function is reflected in the behavior when the configuration changes, such as modifying the mirror version in the Pod template in the configuration. The Deployment Controller automatically creates new pods to run the new images and gradually removes old pods for automatic upgrade purposes.

After reading the above, do you have any further understanding of how to understand Deployment? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report