Create and configure a GKE cluster in Cloud Code for Cloud Shell Stay organized with collections Save and categorize content based on your preferences.
With Cloud Code, you can create a Kubernetes cluster withGoogle Kubernetes Engine (GKE).
Note: For developing and testing an app, create and run on a non-production cluster. For changes that will be rolled out to production, use anautomated CI/CD workflow.Create a GKE cluster and add it to your KubeConfig
To create a cluster:
- Click
Cloud Code and then expand theKubernetes section.
- ClickaddAdd a Cluster to the KubeConfig.
- SelectGoogle Kubernetes Engine and then selectYes to enable theGoogle Kubernetes Engine API in your project.
- ChooseStandard orAutopilot. For more information, seeComparing Autopilot and Standard modes.
- If prompted, clickOpen to permit Cloud Code to open theGoogle Cloud console.
- In Google Cloud console, choose any configuration options that you wantto customize and then clickCreate.
- After the cluster is created, in Cloud Code, click theRefresh icon.
- After the name of your new cluster appears in the list, click the clustername. Your new cluster is added to your kubeconfig and set as the defaultcontext.
Tip: To create a Kubernetes cluster using the command palette, launch thecommand palette (pressCtrl/Cmd+Shift+P or clickView >Command Palette) and then run theCloud Code: Create GKE clustercommand.
Work with an existing GKE cluster
If you have an existing Standard or Autopilot GKE cluster, youcan set it as your active cluster and work with it usingCloud Code.
- Click
Cloud Code and then expand theKubernetes section.
- ClickaddAdd a Cluster to the KubeConfig.
- ClickGoogle Kubernetes Engine.
- Click your cluster name. Your cluster is added to the KubeConfig.
Set a cluster as the default context
The active cluster is the cluster that your application is deployed to bydefault.
- Click
Cloud Code and then expand theKubernetes section.
- Right-click a cluster and then clickSet as Active Cluster.
Run an application on GKE
To run or debug an application on GKE, you'll need to definethe container image repository for your project.
To learn more, seeget started with Cloud Code for Kubernetes
Remove a cluster from your KubeConfig
After you remove a cluster from your KubeConfig, the cluster is not availableto deploy to.
- Click
Cloud Code and then expand theKubernetes section.
- Right-click a cluster and then clickRemove Context Under Cluster.
Open an interactive terminal to a container
- Click
Cloud Code and then expand theKubernetes section.
- Expand your minikube cluster, expandPods, and then expandContainers.
- Right-click a container and then clickGet Terminal.
Open an external IP address
- Click
Cloud Code and then expand theKubernetes section.
- Expand your minikube cluster and then expandServices.
- ExpandExternal IPs, right-click an IP address, and then clickOpen Address.
- ClickOpen.
Create and add a cluster from another cloud provider
If you're using an on-premises cluster or a cluster from another provider suchas Azure or AWS, use the provider's tools to create the cluster and add it toyour KubeConfig.
What's next
- Organize your cluster access using kubeconfig files.
- Learn how to add, delete or switch between yourkubeconfig files in Cloud Code.
- Develop and debug parts of a microservice application using Skaffold.
- Usefile sync and hot reloading to speed up development.
- Debug your application in Cloud Code.
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-12-15 UTC.