This tutorial shows you how to deploy Online Boutique to a Kubernetes cluster.
You'll be able to run Online Boutique on:
- a local minikube cluster, which comes built in to the Cloud Shell instance
- a Google Kubernetes Engine cluster using a new or existing Google Cloud project
Let's get started!
Set up a Kubernetes cluster using the instructions below for either minikube or GKE.
Minikube creates a local Kubernetes cluster on Cloud Shell.
-
Click minikube on the status bar located at the bottom of the editor window.
-
The command palette will prompt you to choose which minikube cluster to control. Select minikube and, in the next prompt, click Start if the cluster has not already been started.
-
If prompted, authorize Cloud Shell to make a GCP API call with your credentials.
It may take a few minutes for minikube to finish starting.
Once minikube has started, you're ready to move on to the next step.
In order to create a GKE cluster, you'll need to create a Google Cloud project or use an existing project.
-
Access the command palette by going to View > Find Command.
-
Run the command "Cloud Code: Create GKE cluster".
-
Select your GCP project.
-
Apply the following configurations in the GKE wizard:
- Zone: us-central1-b
- Cluster name: onlineboutique
- Node count: 4
- Machine type: e2-standard-2
- Click Create Cluster. Once your cluster has been created successfully, you can move on to the next step.
Now you can run Online Boutique on your Kubernetes cluster!
-
Launch the Cloud Code menu from the status bar and select Run on Kubernetes.
-
If prompted to select a Skaffold Profile, select [default].
-
Select Yes to confirm your current context.
-
If you're using a GKE cluster, you'll need to confirm your container image registry.
-
If prompted, authorize Cloud Shell to make a GCP API call with your credentials.
Cloud Code uses configurations defined in skaffold.yaml to build and deploy the app. It may take a few minutes for the deploy to complete.
-
Once the app is running, the local URLs will be displayed in the Output terminal.
-
To access your Online Boutique frontend service, click on the Web Preview button in the upper right of the editor window.
-
Select Change Port and enter '4503' as the port, then click Change and Preview. Your app will open in a new window.
To stop running the app:
-
Go to the Debug view
-
Click the Stop icon.
-
Select Yes to clean up deployed resources.
You can start, stop, and debug apps from the Debug view.
If you've deployed your app to a GKE cluster in your Google Cloud project, you'll want to delete the cluster to avoid incurring charges.
-
Navigate to the Cloud Code - Kubernetes view in the Activity bar.
-
Under the Google Kubernetes Engine Explorer tab, right-click on your cluster and select Delete Cluster.
Congratulations! You've successfully deployed Online Boutique using Cloud Shell.
Try other deployment options for Online Boutique:
- Istio/Cloud Service Mesh: See these instructions.
Learn more about the Cloud Shell IDE environment and the Cloud Code extension.