Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Guestbook with Cloud Code

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.

Table of Contents


What's in this sample

Kubernetes architecture

Kubernetes Architecture Diagram

Directory contents

  • 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 image
    • guestbook-frontend.service.yaml - creates a load balancer and exposes the frontend service on an external IP in the cluster
    • guestbook-backend.deployment.yaml - deploys a pod with the backend container image
    • guestbook-backend.service.yaml - exposes the backend service on an internal IP in the cluster
    • guestbook-mongodb.deployment.yaml - deploys a pod containing a MongoDB instance
    • guestbook-mongodb.service.yaml - exposes the MongoDB service on an internal IP in the cluster

Getting Started

Run the app locally with minikube

  1. To run your application, click on the Cloud Code status bar and select ‘Run on Kubernetes’.
    image

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

  3. 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.
    image

  4. To stop the application, click the stop icon on the Debug Toolbar.

Run the app remotely on Google Kubernetes Engine

Set up a GKE cluster

  1. Navigate to the Cloud Code - Kubernetes explorer using the left side taskbar.

  2. 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.
    image

  3. 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.
    image

  4. Once your GKE cluster has been created, it will be displayed in the Google Kubernetes Engine Explorer.

  5. 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”.
    image

Deploy app to GKE

  1. Click on the Cloud Code status bar and select ‘Run on Kubernetes’.

  2. If prompted, confirm the current context and image registry.

  3. 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.
    image


Next steps

For more Cloud Code tutorials and resources, check out Awesome Cloud Code!


Sign up for User Research

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.