In this lab, you will be tasked with deploying a containerized web app for Helloly, a brand new internet start-up that specialises in saying “Hello world!” as a service. To keep investors happy, you will quickly deploy version 1.0 of the app, using GKE best practices. Soon after, the dev team will ask you to perform a rolling update to version 2.0 of Helloly. However, this version will perform poorly in focus groups and social media trends, so you must use Kubernetes-native tools to roll back the deployment to the previous version.
Successfully complete this lab by achieving the following learning objectives:
- Create the GKE Cluster
- From the GCP menu, select Kubernetes Engine.
- Wait for the API to be enabled. Then click Create cluster.
- Under Cluster set-up guides, click My first cluster.
- Click Create Now. The cluster will take a few minutes to create.
- Deploy the Hello World Application
- From the GCP clusters page, click Connect on your new cluster and select Run in Cloud Shell.
- When the Cloud Shell has spawned, hit Return to run the command.
- If prompted, click Authorize.
- Clone the
kubernetes-engine-samplesrepo from GitHub.
- From the
kubernetes-engine-samples/hello-app/manifestsdirectory, create the initial deployment.
- Remove the placeholder text from the service YAML.
- Create the service.
- After a few minutes, an external IP should be provisioned for your Load Balancer. View the service and external IP.
- Open the external IP in a browser tab to confirm the deployment is working.
- Perform a Rolling Update and a Rollback
- Update the application to version 2 by dynamically setting a new image in the deployment.
- Reload the browser window to observe that the app has been updated to version 2.
- Confirm the rollout.
- At the demand of management, roll back to the much more successful previous version of the app.
- View the history of all revisions for this deployment.
- Because management has decided to go with version 2 after all, use the revision history to roll back to the updated deployment.