In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
One: the upgrade of Deployment
For example:
Click (here) to collapse or open
ApiVersion: apps/v1beta1
Kind: Deployment
Metadata:
Name: nginx-deployment
Spec:
Replicas: 3
Template:
Metadata:
Labels:
App: nginx
Spec:
Containers:
-name: nginx
Images: nginx:1.7.9
Ports:
-containerPort: 801. Set a new mirror name for Deployment through the kubectl set image command
Kubectl set image deployment/nginx-deployment nginx=nginx:1.9.1
two。 Use the kubectl edit command to modify the configuration of Deployment to change spec.template.spec.containers [0] .images from nginx:1.7.9 to 1.9.1; after saving and exiting, kubernetes will automatically upgrade the image.
3. You can view the update process of deployment through kubectl rollout status
In the definition of Deployment, you can specify the policy for Pod updates through spec.strategy:
1.Recreate (rebuild): set spec.strategy.type=Recreate, which means that when Deployment updates Pod, it will kill all running Pod first and then create a new Pod.
2.RollingUpdate (rolling update): update Pod one by one by rolling update. You can control the process of rolling update by setting two parameters (maxUnavailable and maxSurge) under spec.strategy.rollingUpdate.
In general, updating the tag selector of Deployment is discouraged, as this will result in a change in the Pod list selected by Deployment and may conflict with other controllers.
Second: rollback of Deployment
The release history of all Deployment is kept in the system, if you want to roll back:
1. Check the history of this Deployment deployment with the kubectl rollout history command
two。 Undo this release with kubectl rollout undo deployment/nginx-deployment and roll back to the previous deployment version
3. Use kubectl rollout undo deployment/nginx-deployment-- to-revision=2 to roll back to the specified version
Third: suspend and resume the deployment of Deployment to complete complex modifications
In response to a complex Deployment configuration modification, in order to avoid frequently triggering the update operation of Deployment, you can pause the update operation of Deployment, then modify the configuration, and then reply to Deployment. A complete update operation is triggered at once.
Use the command: kubectl rollout pause deployment/nginx-deployment
Four: use the kubectl rolling-update command to complete the rolling upgrade of RC
Corresponding to the rolling upgrade of RC, Kubernetes also provides a kubectl rolling-update command to implement. This command creates a new RC, and then automatically controls that the number of replicas in the old RC is gradually reduced to 0, while the number of Pod replicas in the new RC is gradually increased from 0 to the target value to complete the Pod upgrade. It should be noted that the new and old RC are in the same namespace.
Fifth: update strategies of other management objects
Update strategy of 1.DaemonSet
A.OnDelete: default configuration. The new operation is triggered only after the old Pod is manually deleted by the user.
B.RollingUpdate: the version of Pod will be killed automatically, and then a new version of DaemonSet Pod will be created automatically.
Update strategy of 2.StatefulSet
The update strategy of StatefulSet is gradually coming into line with that of Deployment and DaemonSet.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.