Deploy and update from an IDE
Objectives
Learn how to do the following development tasks in Cloud Shell Editor,an online demonstration IDE:
Create a sample Kubernetes app.
Run, update, and view logs for the app in your development environment.
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:
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.
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.
Go to the GKEClusters page.
Choose a project that contains a GKE cluster.
Note the name of the project and cluster.
You'll need this information later.
Create an app in Cloud Shell Editor
In the Google Cloud console, open Cloud Shellby clickingCloud Shellin the task bar.
Click
OpenEditor .Wait for Cloud Shell Editor to initialize.
In Cloud Shell Editor, clickView >Command Palette.
Search forCloud Code: New Application and click it.
SelectKubernetes Application, then selectGo: Hello World.
Each language framework provides slightly different experiences, and thistutorial describes the features available for Go.
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 basic
go-hello-worldweb app, , that returns a templated "It's running!" response to all received requests.main.goA Kubernetes Deployment specification,
.hello.deployment.yamlA Kubernetes Service specification that defines a load balancer for the app,
.hello.service.yamlASkaffold 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:
In Cloud Shell Editor, clickTerminal >New Terminal.
Start a cluster by running the following command:
minikubestartminikube 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.
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:
In the Cloud Shell Editor status bar, click
CloudCode .SelectRun on Kubernetes.
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.
Watch the deployment status in the
Developmentsessions view.When the deployment is complete, a green check mark appears next toPortforward URLs. The spinning icon appears next toStream Application Logs.
To view your app, look further down theDevelopment sessionspane and findPort Forward URLs >service.
Hold the pointer over
go-hello-world-external and 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:
Modify your
file to print "It's redeployed!". The file saves automatically.main.goWatch the
Developmentsessions view as your app is rebuilt anddeployed.View your redeployed app as you did before:
In theDevelopment sessionspane, findPort Forward URLs >service.
Hold the pointer over
go-hello-world-external and clickOpen URL.
View app logs
In the Cloud Shell Editor menu bar, selectView >Command Palette.
Search forCloud Code: View Logs and click it.
The Logs Viewer opens.
In
Deployment,select go-hello-world.This filters the Logs Viewer to only display logs for your
go-hello-worldapp.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.
To view the newly generated logs in the Logs Viewer, click
Refresh .
Deploy your app to a GKE cluster
Add your GKE cluster to the list of clusters you candeploy to:
In the
Kubernetesview, clickAdd a Cluster to the KubeConfig. In theChoose a platform dialog, clickGoogle Kubernetes Engine.
If prompted to enable the Google Cloud API, clickYes.
Wait for Cloud Shell Editor to find the clusters in yourGoogle Cloud project.
In theCreate or choose a GKE cluster dialog, selectthe name of the cluster you created,hello-world-cluster.
In the Cloud Shell Editor status bar, click
CloudCode and selectRun on Kubernetes.When prompted to select a context for your deployment request, chooseUse current context, which is set to your GKE cluster.
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.
Watch the
Developmentsessions view as your app is rebuilt anddeployed.To view detailed log messages as your app is being deployed to GKE,click theDeploy to Cluster node in theDevelopment sessions view.
To view your running app:
Close the view by clicking theDevelopment sessions heading.
Open the
Kubernetesview. Expand your GKE cluster.
Go toNamespaces > default > Services > go-hello-world-external > External IPs.
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
View code samples demonstrating the usage ofGoogle Cloud products
Install Cloud Code in your IDE
Clean up to avoid billing charges.If you plan to take additional tutorials, wait until you finish those tutorialsbefore you clean up. You can use the sample Kubernetes cluster in mostGKE tutorials.
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.