Deploy and update from an IDE

If you develop applications to run in Google Kubernetes Engine, you can use an IDE andthe Cloud Code plugin to simplify key development tasks, such astesting and debugging locally and deploying to a test cluster.

Objectives

Learn how to do the following development tasks in Cloud Shell Editor,an online demonstration IDE:

  1. Create a sample Kubernetes app.

  2. Run, update, and view logs for the app in your development environment.

  3. Deploy the app to a GKE cluster.

You can follow a similar process in your own IDE if youinstall Cloud Code.


To follow step-by-step guidance for this task directly in the Google Cloud console, clickGuide me:

Guide me


Costs

In this document, you use the following billable components of Google Cloud:

To generate a cost estimate based on your projected usage, use thepricing calculator.

New Google Cloud users might be eligible for afree trial.

When you finish the tasks that are described in this document, you can avoid continued billing by deleting the resources that you created. For more information, seeClean up.

Before you begin

Create a Kubernetes cluster.Create a cluster and deploy a workloadshows you how.

Choose a Google Cloud project and cluster

When you deploy your app to GKE later on in this tutorial, youwill need to specify a Google Cloud project and a GKE cluster.

  1. Go to the GKEClusters page.

    Go to Clusters

  2. Choose a project that contains a GKE cluster.

  3. Note the name of the project and cluster.

    You'll need this information later.

Create an app in Cloud Shell Editor

  1. In the Google Cloud console, open Cloud Shellby clickingCloud Shellin the task bar.

  2. ClickOpenEditor.

  3. Wait for Cloud Shell Editor to initialize.

  4. In Cloud Shell Editor, clickView >Command Palette.

  5. Search forCloud Code: New Application and click it.

  6. SelectKubernetes Application, then selectGo: Hello World.

    Each language framework provides slightly different experiences, and thistutorial describes the features available for Go.

  7. In the Save dialog, clickCreate new application.

    Cloud Shell Editor reloads and shows your app source files in the Explorerview.

The app consists of:

  • A basicgo-hello-world web app,main.go, that returns a templated "It's running!" response to all received requests.

  • A Kubernetes Deployment specification,hello.deployment.yaml.

  • A Kubernetes Service specification that defines a load balancer for the app,hello.service.yaml.

  • ASkaffold file that handles the workflow for building and deploying the app,skaffold.yaml.

Run the app in your development environment

When possible, run apps in your development environment before deployingto GKE. This can help you identify any potential issues withoutusing Google Cloud quota.

To run the app in your Cloud Shell Editor environment:

  1. In Cloud Shell Editor, clickTerminal >New Terminal.

  2. Start a cluster by running the following command:

    minikubestart

    minikube is a lightweight Kubernetes implementation that creates a VM inyour local environment and deploys a simple cluster containing only one node.

    It might take a minute to set up the minikube cluster.

  3. If prompted to authorize Cloud Shell to make Cloud API calls,clickAuthorize.

    After your minikube cluster is set up, a message similar to the followingappears:

    Done! kubectl is now configured touse "minikube" cluster...

After minikube is set up, build and run your app:

  1. In the Cloud Shell Editor status bar, clickCloudCode.

  2. SelectRun on Kubernetes.

  3. If prompted, confirm that you want to use the current minikube context.

    Cloud Shell Editor builds your app and deploys it to the minikube cluster.

  4. Watch the deployment status in theDevelopmentsessions view.

    When the deployment is complete, a green check mark appears next toPortforward URLs. The spinning icon appears next toStream Application Logs.

  5. To view your app, look further down theDevelopment sessionspane and findPort Forward URLs >service.

  6. Hold the pointer overgo-hello-world-externaland clickOpen URL.

Edit your app

When you change a source file in your app, Cloud Shell Editor automaticallybuilds and deploys your app to the cluster that you're currently connected to.In this case, you're connected to your minikube cluster.

To edit and redeploy the app to your local minikube cluster:

  1. Modify yourmain.gofile to print "It's redeployed!". The file saves automatically.

  2. Watch theDevelopmentsessions view as your app is rebuilt anddeployed.

  3. View your redeployed app as you did before:

    1. In theDevelopment sessionspane, findPort Forward URLs >service.

    2. Hold the pointer overgo-hello-world-externaland clickOpen URL.

View app logs

  1. In the Cloud Shell Editor menu bar, selectView >Command Palette.

  2. Search forCloud Code: View Logs and click it.

    The Logs Viewer opens.

  3. InDeployment,selectgo-hello-world.

    This filters the Logs Viewer to only display logs for yourgo-hello-world app.

  4. Switch to the tab with your app that shows "It's redeployed!" Reload thepage in the browser and then switch back to the Cloud Shell tab.

  5. To view the newly generated logs in the Logs Viewer, clickRefresh.

Deploy your app to a GKE cluster

  1. Add your GKE cluster to the list of clusters you candeploy to:

    1. In theKubernetesview, clickAdd a Cluster to the KubeConfig.

    2. In theChoose a platform dialog, clickGoogle Kubernetes Engine.

    3. If prompted to enable the Google Cloud API, clickYes.

    4. Wait for Cloud Shell Editor to find the clusters in yourGoogle Cloud project.

    5. In theCreate or choose a GKE cluster dialog, selectthe name of the cluster you created,hello-world-cluster.

  2. In the Cloud Shell Editor status bar, clickCloudCode and selectRun on Kubernetes.

  3. When prompted to select a context for your deployment request, chooseUse current context, which is set to your GKE cluster.

  4. In theChoose image repository dialog, selectgcr.io/PROJECT_NAME.

    Cloud Shell Editor builds your app into a container and stores the containerin the repository you selected.

  5. Watch theDevelopmentsessions view as your app is rebuilt anddeployed.

  6. To view detailed log messages as your app is being deployed to GKE,click theDeploy to Cluster node in theDevelopment sessions view.

  7. To view your running app:

    1. Close the view by clicking theDevelopment sessions heading.

    2. Open theKubernetesview.

    3. Expand your GKE cluster.

    4. Go toNamespaces > default > Services > go-hello-world-external > External IPs.

    5. Hold the pointer over the IP address and clickOpen URL.

You have successfully created and deployed a GKE app from an IDE.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-27 UTC.