Create and configure a GKE cluster in Cloud Code for Cloud Shell

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:

  1. ClickCloud Code and then expand theKubernetes section.
  2. ClickaddAdd a Cluster to the KubeConfig.
  3. SelectGoogle Kubernetes Engine and then selectYes to enable theGoogle Kubernetes Engine API in your project.
  4. ChooseStandard orAutopilot. For more information, seeComparing Autopilot and Standard modes.
  5. If prompted, clickOpen to permit Cloud Code to open theGoogle Cloud console.
  6. In Google Cloud console, choose any configuration options that you wantto customize and then clickCreate.
  7. After the cluster is created, in Cloud Code, click theRefresh icon.
  8. 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.

  1. ClickCloud Code and then expand theKubernetes section.
  2. ClickaddAdd a Cluster to the KubeConfig.
  3. ClickGoogle Kubernetes Engine.
  4. 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.

  1. ClickCloud Code and then expand theKubernetes section.
  2. 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.

  1. ClickCloud Code and then expand theKubernetes section.
  2. Right-click a cluster and then clickRemove Context Under Cluster.

Open an interactive terminal to a container

  1. ClickCloud Code and then expand theKubernetes section.
  2. Expand your minikube cluster, expandPods, and then expandContainers.
  3. Right-click a container and then clickGet Terminal.

Open an external IP address

  1. ClickCloud Code and then expand theKubernetes section.
  2. Expand your minikube cluster and then expandServices.
  3. ExpandExternal IPs, right-click an IP address, and then clickOpen Address.
  4. 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

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.