The Guestbook sample demonstrates how to deploy a Kubernetes application with a front end service and a back end service using the Cloud Code extension for Visual Studio Code. When you run the application, Cloud Code uses skaffold under the hood to build an image and deploy the project's Kubernetes manifests. To learn more about Kubernetes, explore the Kubernetes overview.
-
skaffold.yaml- A schema file that defines skaffold configurations (skaffold.yaml reference) -
kubernetes-manifests/- Contains Kubernetes YAML files for the Guestbook services and deployments, including:guestbook-frontend.deployment.yaml- deploys a pod with the frontend container imageguestbook-frontend.service.yaml- creates a load balancer and exposes the frontend service on an external IP in the clusterguestbook-backend.deployment.yaml- deploys a pod with the backend container imageguestbook-backend.service.yaml- exposes the backend service on an internal IP in the clusterguestbook-mongodb.deployment.yaml- deploys a pod containing a MongoDB instanceguestbook-mongodb.service.yaml- exposes the MongoDB service on an internal IP in the cluster
-
To run your application, click on the Cloud Code status bar and select ‘Run on Kubernetes’.

-
Select ‘Run locally using minikube’ when prompted. Cloud Code runs your app in a local minikube cluster.

-
View the build progress in the OUTPUT window. Once the build has finished, click on the front end service's URL in the OUTPUT window to view your live application.

-
To stop the application, click the stop icon on the Debug Toolbar.
-
Navigate to the Cloud Code - Kubernetes explorer using the left side taskbar.
-
In the Google Kubernetes Engine Explorer, click '+' to create a new Google Kubernetes Engine cluster. If prompted, follow the instructions to log in to Google Cloud Platform.

-
Configure your new cluster using the GKE wizard and click 'Create Cluster'. Once your GKE cluster has been created, it will be displayed in the Google Kubernetes Engine Explorer.

-
Once your GKE cluster has been created, it will be displayed in the Google Kubernetes Engine Explorer.
-
Your new cluster will be set as the active cluster by default. To switch clusters, right click on a different cluster in the GKE Explorer and select “Set Active Cluster”.

-
Click on the Cloud Code status bar and select ‘Run on Kubernetes’.
-
If prompted, confirm the current context and image registry.
-
View the build’s progress in the OUTPUT window. Once the build has finished, you can visit your deployed app by clicking the URL in the OUTPUT window.

- Try debugging your app using Cloud Code
- Navigate the Kubernetes Engine Explorer
- Learn how to edit YAML files to deploy your Kubernetes app
- Configure an existing app to run on Cloud Code
- Enable Cloud APIs and client libraries
- Manage secrets with Secret Manager
For more Cloud Code tutorials and resources, check out Awesome Cloud Code!
We want to hear your feedback!
The Cloud Code team is inviting our user community to sign-up to participate in Google User Experience Research.
If you’re invited to join a study, you may try out a new product or tell us what you think about the products you use every day. At this time, Google is only sending invitations for upcoming remote studies. Once a study is complete, you’ll receive a token of thanks for your participation such as a gift card or some Google swag.
Sign up using this link and answer a few questions about yourself, as this will help our research team match you to studies that are a great fit.
