Duration: 10:00
It’s easy to update & rollback.
In this lab, we’ll switch to the frontend/ directory and make a minor change to the index.html (e.g., change the background color, title, etc.). After that, rebuild the container.
[vagrant@rhel-cdk kubernetes]$ cd ~/kubernetes-lab/frontend
[vagrant@rhel-cdk kubernetes]$ vi index.html
[vagrant@rhel-cdk kubernetes]$ docker build -t rafabene/microservices-frontend:2.0 .
Tip
|
HINT 1: Change the <h2>Say Hi</h2> line, but feel free to change any HTML content that that you want HINT 2: Type ':51' to go to that line HINT 3: Type 'i' to enter in edit mode HINT 4: Type ':wq' to exit from vi |
Now we will use the kubectl rolling-update command to perform the rolling update. We create a new ReplicationController called frontend-ui-2 that contains the new image.
[vagrant@rhel-cdk frontend]$ kubectl rolling-update frontend-ui frontend-ui-2 --image=rafabene/microservices-frontend:2.0 --update-period=1s
Created frontend-ui-2
Scaling up frontend-ui-2 from 0 to 2, scaling down frontend-ui from 2 to 0 (keep 2 pods available, don’t exceed 3 pods)
Scaling frontend-ui-2 up to 1
Scaling frontend-ui down to 1
Scaling frontend-ui-2 up to 2
Scaling frontend-ui down to 0
Update succeeded. Deleting frontend-ui
replicationcontroller "frontend-ui" rolling updated to "frontend-ui-2"
That’s it! Kubernetes will performed a rolling update to update all the versions from 1.0 to 2.0.
Note
|
This 2.0 version only exists in your local registry. It will only be available if you have built it using the docker build command. |