docs/cloudshell-tutorial.md
This tutorial shows you how to deploy Online Boutique to a Kubernetes cluster.
You'll be able to run Online Boutique on:
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 <walkthrough-editor-spotlight spotlightId="minikube-status-bar">minikube</walkthrough-editor-spotlight> 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
Now you can run Online Boutique on your Kubernetes cluster!
Launch the <walkthrough-editor-spotlight spotlightId="cloud-code-status-bar">Cloud Code menu</walkthrough-editor-spotlight> from the status bar and select <walkthrough-editor-spotlight spotlightId="cloud-code-run-on-k8s">Run on Kubernetes</walkthrough-editor-spotlight>.
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 <walkthrough-editor-open-file filePath="skaffold.yaml">skaffold.yaml</walkthrough-editor-open-file> 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 <walkthrough-editor-spotlight spotlightId="output">Output</walkthrough-editor-spotlight> terminal.
To access your Online Boutique frontend service, click on the <walkthrough-spotlight-pointer spotlightId="devshell-web-preview-button" target="cloudshell">Web Preview button</walkthrough-spotlight-pointer> 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 <walkthrough-editor-spotlight spotlightId="activity-bar-debug">Debug view</walkthrough-editor-spotlight>
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 <walkthrough-editor-spotlight spotlightId="activity-bar-cloud-k8s">Cloud Code - Kubernetes view</walkthrough-editor-spotlight> in the Activity bar.
Under the <walkthrough-editor-spotlight spotlightId="cloud-code-gke-explorer">Google Kubernetes Engine Explorer tab</walkthrough-editor-spotlight>, right-click on your cluster and select Delete Cluster.
<walkthrough-conclusion-trophy></walkthrough-conclusion-trophy>
Congratulations! You've successfully deployed Online Boutique using Cloud Shell.
<walkthrough-inline-feedback></walkthrough-inline-feedback>
Try other deployment options for Online Boutique:
Learn more about the Cloud Shell IDE environment and the Cloud Code extension.