In this lab, we will make a change to the web application and then re-deploy the new container image into AKS.
-
Use the editor of your choice and browse to
~/blackbelt-aks-hackfest/app/web/src/components/
-
Edit code for the
Footer.vue
-
Find the snippet below (line 13) and change the text "Azure Global Blackbelt Team" to your name or whatever you would like to display.
<div class="row at-row flex-center flex-middle"> <div class="col-lg-6"> </div> <div class="col-lg-12 credits"> Azure Global Blackbelt Team </div> <div class="col-lg-6"> </div> </div>
-
Save your edits and close the file
-
Browse to
~/blackbelt-aks-hackfest/app/web
-
You should still have a Dockerfile created in an earlier lab
-
Create a new image with an updated image tag
docker build -t rating-web:new-version .
-
Tag the new image and push to your Azure Container Registry
# you may need to login again to your ACR. set these values to yours ACR_SERVER= ACR_USER= ACR_PWD= docker login --username $ACR_USER --password $ACR_PWD $ACR_SERVER docker tag rating-web:new-version $ACR_SERVER/azureworkshop/rating-web:new-version docker push $ACR_SERVER/azureworkshop/rating-web:new-version
-
Verify image was pushed to ACR by checking your registry in the Azure Portal
There are two ways to update the application with the new version. Both are described below. Choose one to proceed.
- Edit the YAML file and re-apply
- Update the deployment and re-set the image tag
-
As we did in a prior lab, open the
helper-files
directory and review the fileheroes-web-api.yaml
-
Update the yaml file and replace the tag from
v1
tonew-version
spec: containers: - image: mycontainerregistry.azurecr.io/azureworkshop/rating-web:new-version name: heroes-web-cntnr
-
Apply the new yaml file
cd ~/blackbelt-aks-hackfest/labs/helper-files kubectl apply -f heroes-web-api.yaml
- Set the new image tag on the deployment object
kubectl get deploy NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE heroes-api-deploy 1 1 1 1 29m heroes-db-deploy 1 1 1 1 32m heroes-web-depoy 1 1 1 1 29m kubectl set image deployment/heroes-web-deploy heroes-web-cntnr=$ACR_SERVER/azureworkshop/rating-web:new-version
- You can see the updates and history for the changes from above
# this command will verify that latest deployment was successful kubectl rollout status deployment/heroes-web-deploy # each deployment creates a new replicaset kubectl get replicaset | grep web heroes-web-556f6f976c 0 0 0 34m heroes-web-64f4795689 0 0 0 8m heroes-web-67b4b7b887 1 1 1 1m kubectl rollout history deployment/heroes-web-deploy