Updating Deployments
Learn to update the Kubernetes Deployments.
Updating the db
image
Let’s see what happens when we set
a new image to the db
Pod.
Press + to interact
kubectl set image \-f go-demo-2-db.yml \db=mongo:3.4 \--record
It’ll take a while until the new image is pulled.
Describing the deployment
Once it’s done, we can describe
the Deployment by checking the events it created.
Press + to interact
kubectl describe \-f go-demo-2-db.yml
The last few lines of the output are as follows:
Press + to interact
...Events:Type Reason Age From Message---- ------ ---- ---- -------Normal ScalingReplicaSet 101s deployment-controller Scaled up replica set go-demo-2-db-76668544d4 to 1Normal ScalingReplicaSet 11s deployment-controller Scaled up replica set go-demo-2-db-6b48fcbfcf to 1Normal ScalingReplicaSet 10s deployment-controller Scaled down replica set go-demo-2-db-76668544d4 to 0
We can see that it creates a new ReplicaSet and scales the old ReplicaSet to 0
. If, in your case, the last line did not appear, you’ll need to wait until the new version of the mongo
image is pulled.
Instead of operating directly on the level of Pods, the Deployment creates a new ReplicaSet which subsequently produces Pods based on the new image. Once they ...