Today, I will continue to introduce the relevant knowledge of Linux operation and maintenance. The main content of this article is to update the deployment controller and view it.
1. Deployment controller update preparation
Next, we will carry out the actual update of the Deployment.
First, we create a Deployment controller. The created Deployment controller uses the v1 version of the myapp image, as shown below:
After that, we open two additional terminals and execute the commands respectively:
kubectl get pods -l pod=myapp -w
and
kubectl get deployment deployment -w
In the first command, we use the -l parameter to specify to view the Pod object of pod=myapp, which is actually the Pod object controlled by the Deployment controller; in the second command, there are two deployments, the first is to specify The kubectl command looks at the deployment controller, and the second is the name of the deployment controller (yes, the name of the deployment controller is deployment, if you have doubts, you can check the article: Kubernetes Detailed Explanation (22) - Deployment Control device ). The -w parameter in the two commands indicates dynamic viewing.
2. Deployment controller update
Next, we start to update the Deployment controller and execute the command:
kubectl set image deployment/deployment myapp=ikubernetes/myapp:v2
This command is used to specify that the image of the Deployment controller is set to the v2 version of myapp. The execution result of the command is as follows:
3. Deployment control update view
After the controller update is complete, let's look at the command execution on the other two terminals. Among them, the results of monitoring the changes of the Pod are as follows:
and the results of monitoring the changes of the Deployment controller are as follows:
Finally, after our pod is stable, the results are as follows:
From the above process, we can see that our Deployment controller has been updated.
Originality is not easy, please indicate the source for reprinting: https://blog.csdn.net/weixin_40228200